Skip to content

Commit

Permalink
fix: using __cpp_nontype_template_args instead of `__cpp_nontype_te…
Browse files Browse the repository at this point in the history
…mplate_parameter_class` (#5330)

* fix: use `__cpp_nontype_template_args` instead of gnu extensions

* fix: add feature test value

* fix: change `PYBIND11_TYPING_H_HAS_STRING_LITERAL` skip reason
  • Loading branch information
ObeliskGate committed Aug 26, 2024
1 parent e8f595b commit 3fb16ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions include/pybind11/typing.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ class Never : public none {
using none::none;
};

#if defined(__cpp_nontype_template_parameter_class) \
&& (/* See #5201 */ !defined(__GNUC__) \
|| (__GNUC__ > 10 || (__GNUC__ == 10 && __GNUC_MINOR__ >= 3)))
#if defined(__cpp_nontype_template_args) && __cpp_nontype_template_args >= 201911L
# define PYBIND11_TYPING_H_HAS_STRING_LITERAL
template <size_t N>
struct StringLiteral {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pytypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ def test_optional_object_annotations(doc):

@pytest.mark.skipif(
not m.defined_PYBIND11_TYPING_H_HAS_STRING_LITERAL,
reason="C++20 feature not available.",
reason="C++20 non-type template args feature not available.",
)
def test_literal(doc):
assert (
Expand All @@ -1037,7 +1037,7 @@ def test_literal(doc):

@pytest.mark.skipif(
not m.defined_PYBIND11_TYPING_H_HAS_STRING_LITERAL,
reason="C++20 feature not available.",
reason="C++20 non-type template args feature not available.",
)
def test_typevar(doc):
assert (
Expand Down

0 comments on commit 3fb16ad

Please sign in to comment.