Skip to content

Commit

Permalink
fix: remove deprecated operator"" syntax usage (#661)
Browse files Browse the repository at this point in the history
Clang warns about this. Apparently GCC 4.9 may warn about the fixed
syntax, though!

Spotted in the ADBC CI:

```
 /adbc/c/vendor/nanoarrow/nanoarrow.hpp:94:35: error: identifier '_asv' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
   94 | inline ArrowStringView operator"" _asv(const char* data, std::size_t size_bytes) {
      |                        ~~~~~~~~~~~^~~~
      |                        operator""_asv
```
  • Loading branch information
lidavidm authored Oct 15, 2024
1 parent 8dc7a39 commit 206e0e3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/nanoarrow/nanoarrow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,16 @@ namespace literals {
/// @{

/// \brief User literal operator allowing ArrowStringView construction like "str"_asv
#if !defined(__clang__) && (defined(__GNUC__) && __GNUC__ < 6)
inline ArrowStringView operator"" _asv(const char* data, std::size_t size_bytes) {
return {data, static_cast<int64_t>(size_bytes)};
}
#else
inline ArrowStringView operator""_asv(const char* data, std::size_t size_bytes) {
return {data, static_cast<int64_t>(size_bytes)};
}
#endif
// N.B. older GCC requires the space above, newer Clang forbids the space

// @}

Expand Down

0 comments on commit 206e0e3

Please sign in to comment.