Skip to content

Commit 604ffe0

Browse files
ObeliskGatehenryiii
authored andcommitted
fix: using __cpp_nontype_template_args instead of __cpp_nontype_template_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
1 parent 6154d84 commit 604ffe0

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

include/pybind11/typing.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ class Never : public none {
100100
using none::none;
101101
};
102102

103-
#if defined(__cpp_nontype_template_parameter_class) \
104-
&& (/* See #5201 */ !defined(__GNUC__) \
105-
|| (__GNUC__ > 10 || (__GNUC__ == 10 && __GNUC_MINOR__ >= 3)))
103+
#if defined(__cpp_nontype_template_args) && __cpp_nontype_template_args >= 201911L
106104
# define PYBIND11_TYPING_H_HAS_STRING_LITERAL
107105
template <size_t N>
108106
struct StringLiteral {

tests/test_pytypes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ def test_optional_object_annotations(doc):
10261026

10271027
@pytest.mark.skipif(
10281028
not m.defined_PYBIND11_TYPING_H_HAS_STRING_LITERAL,
1029-
reason="C++20 feature not available.",
1029+
reason="C++20 non-type template args feature not available.",
10301030
)
10311031
def test_literal(doc):
10321032
assert (
@@ -1037,7 +1037,7 @@ def test_literal(doc):
10371037

10381038
@pytest.mark.skipif(
10391039
not m.defined_PYBIND11_TYPING_H_HAS_STRING_LITERAL,
1040-
reason="C++20 feature not available.",
1040+
reason="C++20 non-type template args feature not available.",
10411041
)
10421042
def test_typevar(doc):
10431043
assert (

0 commit comments

Comments
 (0)