diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-22 20:55:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-11-22 20:55:38 +0100 |
commit | 761df90687c2cda775d86491b54d549bf57e9bc1 (patch) | |
tree | 1b208626f9aea40ce8582b769e0c082c50a1b73d /gcc/c-family/c-cppbuiltin.c | |
parent | 204b0bebee5343b5bd07e2a7be6fd74d6698b937 (diff) | |
download | gcc-761df90687c2cda775d86491b54d549bf57e9bc1.zip gcc-761df90687c2cda775d86491b54d549bf57e9bc1.tar.gz gcc-761df90687c2cda775d86491b54d549bf57e9bc1.tar.bz2 |
Implement P1902R1, Missing feature-test macros 2017-2019.
* c-cppbuiltin.c (c_cpp_builtins): Bump __cpp_init_captures
and __cpp_generic_lambdas for -std=c++2a. Define
__cpp_designated_initializers, __cpp_constexpr_in_decltype and
__cpp_consteval for -std=c++2a. Remove a FIXME comment about
__cpp_concepts for -std=c++2a.
* g++.dg/cpp1z/feat-cxx1z.C: Only compile with -std=c++17.
* g++.dg/cpp2a/feat-cxx2a.C: Adjust for P1902R1 changes.
* g++.dg/cpp2a/desig15.C: New test.
* g++.dg/cpp2a/lambda-pack-init3.C: New test.
* g++.dg/cpp2a/lambda-generic6.C: New test.
* g++.dg/cpp2a/consteval15.C: New test.
From-SVN: r278628
Diffstat (limited to 'gcc/c-family/c-cppbuiltin.c')
-rw-r--r-- | gcc/c-family/c-cppbuiltin.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 76d1e4a..50066e4 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -952,8 +952,11 @@ c_cpp_builtins (cpp_reader *pfile) { /* Set feature test macros for C++14. */ cpp_define (pfile, "__cpp_return_type_deduction=201304L"); - cpp_define (pfile, "__cpp_init_captures=201304L"); - cpp_define (pfile, "__cpp_generic_lambdas=201304L"); + if (cxx_dialect <= cxx17) + { + cpp_define (pfile, "__cpp_init_captures=201304L"); + cpp_define (pfile, "__cpp_generic_lambdas=201304L"); + } if (cxx_dialect <= cxx14) cpp_define (pfile, "__cpp_constexpr=201304L"); cpp_define (pfile, "__cpp_decltype_auto=201304L"); @@ -990,7 +993,12 @@ c_cpp_builtins (cpp_reader *pfile) if (cxx_dialect > cxx17) { /* Set feature test macros for C++2a. */ + cpp_define (pfile, "__cpp_init_captures=201803L"); + cpp_define (pfile, "__cpp_generic_lambdas=201707L"); + cpp_define (pfile, "__cpp_designated_initializers=201707L"); + cpp_define (pfile, "__cpp_constexpr_in_decltype=201711L"); cpp_define (pfile, "__cpp_conditional_explicit=201806L"); + cpp_define (pfile, "__cpp_consteval=201811L"); cpp_define (pfile, "__cpp_constinit=201907L"); cpp_define (pfile, "__cpp_nontype_template_parameter_class=201806L"); cpp_define (pfile, "__cpp_impl_destroying_delete=201806L"); @@ -1000,7 +1008,6 @@ c_cpp_builtins (cpp_reader *pfile) if (flag_concepts) { if (cxx_dialect >= cxx2a) - /* FIXME: Update this to the value required by the IS. */ cpp_define (pfile, "__cpp_concepts=201907L"); else cpp_define (pfile, "__cpp_concepts=201507L"); |