Resolve gcc 4.8.5 error:

```
pytypes.h:1615:12: error: missing space between '""' and suffix identifier
```
This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-07-26 13:16:42 -07:00
parent 1fb7dc3c64
commit b9f3380130
2 changed files with 18 additions and 2 deletions

View File

@ -1377,7 +1377,15 @@ inline namespace literals {
/** \rst /** \rst
String literal version of `arg` String literal version of `arg`
\endrst */ \endrst */
constexpr arg operator""_a(const char *name, size_t) { return arg(name); } constexpr arg
#if defined(__GNUC__) && __GNUC__ < 5
operator"" _a // gcc 4.8.5 insists on having a space (hard error).
#else
operator""_a // clang 17 generates a deprecation warning if there is a space.
#endif
(const char *name, size_t) {
return arg(name);
}
} // namespace literals } // namespace literals
PYBIND11_NAMESPACE_BEGIN(detail) PYBIND11_NAMESPACE_BEGIN(detail)

View File

@ -1612,7 +1612,15 @@ inline namespace literals {
/** \rst /** \rst
String literal version of `str` String literal version of `str`
\endrst */ \endrst */
inline str operator""_s(const char *s, size_t size) { return {s, size}; } inline str
#if defined(__GNUC__) && __GNUC__ < 5
operator"" _s // gcc 4.8.5 insists on having a space (hard error).
#else
operator""_s // clang 17 generates a deprecation warning if there is a space.
#endif
(const char *s, size_t size) {
return {s, size};
}
} // namespace literals } // namespace literals
/// \addtogroup pytypes /// \addtogroup pytypes