[gcc r16-9321] c++: implement CWG3020 - Missing specification for __has_cpp_attribute(indeterminate) [PR126309]
Jakub Jelinek
jakub@gcc.gnu.org
Mon Jul 20 21:43:08 GMT 2026
https://gcc.gnu.org/g:13631c446806527c9aad99c3d2c1536c1c950cd1
commit r16-9321-g13631c446806527c9aad99c3d2c1536c1c950cd1
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Jul 20 23:32:40 2026 +0200
c++: implement CWG3020 - Missing specification for __has_cpp_attribute(indeterminate) [PR126309]
The paper which introduced indeterminate attribute has not added a value
for __has_cpp_attribute, so I've missed it and didn't add it to
c_common_has_attribute. Later CWG issue fixed this up.
2026-07-20 Jakub Jelinek <jakub@redhat.com>
PR c++/126309
* c-lex.cc: Implement CWG3020 - Missing specification for
__has_cpp_attribute(indeterminate).
(c_common_has_attribute): Handle __has_cpp_attribute (indeterminate).
* g++.dg/cpp26/feat-cxx26.C: Test __has_cpp_attribute (indeterminate).
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 71a5a83ea92f4cde1ca2b37f3b160353a729f35b)
Diff:
---
gcc/c-family/c-lex.cc | 2 ++
gcc/testsuite/g++.dg/cpp26/feat-cxx26.C | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc
index 1750fbc3d062..09fbbdd22562 100644
--- a/gcc/c-family/c-lex.cc
+++ b/gcc/c-family/c-lex.cc
@@ -433,6 +433,8 @@ c_common_has_attribute (cpp_reader *pfile, bool std_syntax)
result = 201907;
else if (is_attribute_p ("assume", attr_name))
result = 202207;
+ else if (is_attribute_p ("indeterminate", attr_name))
+ result = 202403;
else if (is_attribute_p ("init_priority", attr_name))
{
/* The (non-standard) init_priority attribute is always
diff --git a/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C b/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
index 248116699617..66b3cd7ceecb 100644
--- a/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
+++ b/gcc/testsuite/g++.dg/cpp26/feat-cxx26.C
@@ -652,3 +652,15 @@
#elif __cpp_expansion_statements != 202506
# error "__cpp_expansion_statements != 202506"
#endif
+
+// C++26 attributes:
+
+#ifdef __has_cpp_attribute
+# if ! __has_cpp_attribute(indeterminate)
+# error "__has_cpp_attribute(indeterminate)"
+# elif __has_cpp_attribute(indeterminate) != 202403
+# error "__has_cpp_attribute(indeterminate) != 202403"
+# endif
+#else
+# error "__has_cpp_attribute"
+#endif
More information about the Gcc-cvs
mailing list