From d4a3152d3f3f62ccd614df5da6c3c0d2f6e5fa0d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 13 Nov 2020 14:15:46 -0500 Subject: [PATCH] c++: Add feature test macro for C++20 using enum. Missing piece from the 'using enum' implementation patch. 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 -- 2.30.2