From acaa5911a2359a92b46a8dc2e6f32929bfc5aa42 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 11 Dec 2014 22:49:19 -0500 Subject: [PATCH] * c-cppbuiltin.c (c_cpp_builtins): Enable C++14 __cpp_constexpr. From-SVN: r218656 --- gcc/c-family/ChangeLog | 2 ++ gcc/c-family/c-cppbuiltin.c | 6 +++--- gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C | 11 ++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index db08d185e08..f064370cc78 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,7 @@ 2014-12-11 Jason Merrill + * c-cppbuiltin.c (c_cpp_builtins): Enable C++14 __cpp_constexpr. + * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_runtime_arrays if we aren't complaining about VLAs. diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 54d3acd8547..2dfecb659d9 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -845,7 +845,8 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_unicode_literals=200710"); cpp_define (pfile, "__cpp_user_defined_literals=200809"); cpp_define (pfile, "__cpp_lambdas=200907"); - cpp_define (pfile, "__cpp_constexpr=200704"); + if (cxx_dialect == cxx11) + cpp_define (pfile, "__cpp_constexpr=200704"); cpp_define (pfile, "__cpp_range_based_for=200907"); cpp_define (pfile, "__cpp_static_assert=200410"); cpp_define (pfile, "__cpp_decltype=200707"); @@ -865,8 +866,7 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_return_type_deduction=201304"); cpp_define (pfile, "__cpp_init_captures=201304"); cpp_define (pfile, "__cpp_generic_lambdas=201304"); - //cpp_undef (pfile, "__cpp_constexpr"); - //cpp_define (pfile, "__cpp_constexpr=201304"); + cpp_define (pfile, "__cpp_constexpr=201304"); cpp_define (pfile, "__cpp_decltype_auto=201304"); cpp_define (pfile, "__cpp_aggregate_nsdmi=201304"); cpp_define (pfile, "__cpp_variable_templates=201304"); diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C index d271752ec10..36e11354fb7 100644 --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C @@ -47,12 +47,6 @@ # error "__cpp_lambdas != 200907" #endif -#ifndef __cpp_constexpr -# error "__cpp_constexpr" -#elif __cpp_constexpr != 200704 -# error "__cpp_constexpr != 200704" -#endif - #ifndef __cpp_range_based_for # error "__cpp_range_based_for" #elif __cpp_range_based_for != 200907 @@ -145,11 +139,10 @@ # error "__cpp_generic_lambdas != 201304" #endif -// TODO: Change 200704 to 201304 when C++14 constexpr goes in. #ifndef __cpp_constexpr # error "__cpp_constexpr" -#elif __cpp_constexpr != 200704 -# error "__cpp_constexpr != 200704" +#elif __cpp_constexpr != 201304 +# error "__cpp_constexpr != 201304" #endif #ifndef __cpp_decltype_auto -- 2.30.2