aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-12-11 22:49:19 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-12-11 22:49:19 -0500
commitacaa5911a2359a92b46a8dc2e6f32929bfc5aa42 (patch)
tree433ad91844f3de3e0c574a38227fd00e3e932281 /gcc
parent94a073b2515f43d69404f14cd4a66eaa5301c734 (diff)
downloadgcc-acaa5911a2359a92b46a8dc2e6f32929bfc5aa42.zip
gcc-acaa5911a2359a92b46a8dc2e6f32929bfc5aa42.tar.gz
gcc-acaa5911a2359a92b46a8dc2e6f32929bfc5aa42.tar.bz2
* c-cppbuiltin.c (c_cpp_builtins): Enable C++14 __cpp_constexpr.
From-SVN: r218656
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog2
-rw-r--r--gcc/c-family/c-cppbuiltin.c6
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C11
3 files changed, 7 insertions, 12 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index db08d18..f064370 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,7 @@
2014-12-11 Jason Merrill <jason@redhat.com>
+ * 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 54d3acd..2dfecb6 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 d271752..36e1135 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