[pushed] c++: Add feature test macro for C++20 using enum.
Jason Merrill
jason@redhat.com
Fri Nov 13 21:34:17 GMT 2020
Missing piece from the 'using enum' implementation patch.
Tested x86_64-pc-linux-gnu, applying to trunk.
gcc/c-family/ChangeLog:
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_using_enum.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/feat-cxx2a.C: Check it.
---
gcc/c-family/c-cppbuiltin.c | 1 +
gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 15f71e681ac..7229c59dd6b 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1005,6 +1005,7 @@ c_cpp_builtins (cpp_reader *pfile)
cpp_define (pfile, "__cpp_constexpr_dynamic_alloc=201907L");
cpp_define (pfile, "__cpp_impl_three_way_comparison=201907L");
cpp_define (pfile, "__cpp_aggregate_paren_init=201902L");
+ cpp_define (pfile, "__cpp_using_enum=201907L");
}
if (flag_concepts)
{
diff --git a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
index 7f1fe34ad7f..dc46e48f6d7 100644
--- a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
+++ b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
@@ -533,3 +533,9 @@
#elif __cpp_concepts != 201907
# error "__cpp_concepts != 201907"
#endif
+
+#ifndef __cpp_using_enum
+# error "__cpp_using_enum"
+#elif __cpp_using_enum != 201907
+# error "__cpp_using_enum != 201907"
+#endif
base-commit: 1a90e99fa2f2423a195301adca060dccc3d0755e
--
2.18.4
More information about the Gcc-patches
mailing list