diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2015-08-18 14:38:51 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2015-08-18 14:38:51 +0000 |
commit | 329524f5683acb537a2796f29a3a985dd8548bf7 (patch) | |
tree | 90e6b9dd5e6bcbeae6d2e922632eb8e97aae42e0 | |
parent | 41dd7cf7479cd0051e4a7baa7e680d7bb02af331 (diff) | |
download | gcc-329524f5683acb537a2796f29a3a985dd8548bf7.zip gcc-329524f5683acb537a2796f29a3a985dd8548bf7.tar.gz gcc-329524f5683acb537a2796f29a3a985dd8548bf7.tar.bz2 |
re PR c++/67160 (static_assert feature test macro)
c-family/
2015-08-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67160
* c-cppbuiltin.c (c_cpp_builtins): Fix __cpp_static_assert value
in c++1z mode.
testsuite/
2015-08-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67160
* g++.dg/cpp1z/feat-cxx1z.C: New.
From-SVN: r226972
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-cppbuiltin.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C | 8 |
4 files changed, 28 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 86e421f..6200d1b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2015-08-18 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67160 + * c-cppbuiltin.c (c_cpp_builtins): Fix __cpp_static_assert value + in c++1z mode. + 2015-08-17 Marek Polacek <polacek@redhat.com> * c-pretty-print.c (pp_c_cv_qualifiers): Remove code dealing diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 6e18a77..0e45a57 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -832,7 +832,7 @@ c_cpp_builtins (cpp_reader *pfile) if (cxx_dialect >= cxx11) { - /* Set feature test macros for C++11 */ + /* Set feature test macros for C++11. */ cpp_define (pfile, "__cpp_unicode_characters=200704"); cpp_define (pfile, "__cpp_raw_strings=200710"); cpp_define (pfile, "__cpp_unicode_literals=200710"); @@ -841,7 +841,8 @@ c_cpp_builtins (cpp_reader *pfile) 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"); + if (cxx_dialect <= cxx14) + cpp_define (pfile, "__cpp_static_assert=200410"); cpp_define (pfile, "__cpp_decltype=200707"); cpp_define (pfile, "__cpp_attributes=200809"); cpp_define (pfile, "__cpp_rvalue_reference=200610"); @@ -855,7 +856,7 @@ c_cpp_builtins (cpp_reader *pfile) } if (cxx_dialect > cxx11) { - /* Set feature test macros for C++14 */ + /* Set feature test macros for C++14. */ cpp_define (pfile, "__cpp_return_type_deduction=201304"); cpp_define (pfile, "__cpp_init_captures=201304"); cpp_define (pfile, "__cpp_generic_lambdas=201304"); @@ -865,6 +866,11 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_variable_templates=201304"); cpp_define (pfile, "__cpp_digit_separators=201309"); } + if (cxx_dialect > cxx14) + { + /* Set feature test macros for C++1z. */ + cpp_define (pfile, "__cpp_static_assert=201411"); + } if (flag_concepts) /* Use a value smaller than the 201507 specified in the TS, since we don't yet support extended auto. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 97322ac..ede4dc4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-18 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67160 + * g++.dg/cpp1z/feat-cxx1z.C: New. + 2015-08-18 Marek Polacek <polacek@redhat.com> PR middle-end/67222 diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C new file mode 100644 index 0000000..b3e742c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C @@ -0,0 +1,8 @@ +// { dg-do compile } +// { dg-options "-std=c++1z" } + +#ifndef __cpp_static_assert +# error "__cpp_static_assert" +#elif __cpp_static_assert != 201411 +# error "__cpp_static_assert != 201411" +#endif |