diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-05-15 12:01:07 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-05-15 12:01:07 -0400 |
commit | 32b81d897629b6c3bd9e2780831a1c45b38b5ac3 (patch) | |
tree | 0abc991788126e788ad7cbe6355f8d2f45210a87 | |
parent | 5ed880788ba33302de5d78574464201e0fecbc70 (diff) | |
download | gcc-32b81d897629b6c3bd9e2780831a1c45b38b5ac3.tar.gz |
c++: add feature-test macro for auto(x)
This adds the feature-test macro for PR0849R8, as per
https://github.com/cplusplus/CWG/issues/281.
gcc/c-family/ChangeLog:
* c-cppbuiltin.cc (c_cpp_builtins): Predefine __cpp_auto_cast
for C++23.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/feat-cxx2b.C: Test __cpp_auto_cast.
-rw-r--r-- | gcc/c-family/c-cppbuiltin.cc | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc index 98f5aef2af9..5d64625fcd7 100644 --- a/gcc/c-family/c-cppbuiltin.cc +++ b/gcc/c-family/c-cppbuiltin.cc @@ -1074,6 +1074,7 @@ c_cpp_builtins (cpp_reader *pfile) /* Set feature test macros for C++23. */ cpp_define (pfile, "__cpp_size_t_suffix=202011L"); cpp_define (pfile, "__cpp_if_consteval=202106L"); + cpp_define (pfile, "__cpp_auto_cast=202110L"); cpp_define (pfile, "__cpp_constexpr=202211L"); cpp_define (pfile, "__cpp_multidimensional_subscript=202211L"); cpp_define (pfile, "__cpp_named_character_escapes=202207L"); diff --git a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C index 6f4f6bcaad0..9e29b01adc1 100644 --- a/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C +++ b/gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C @@ -578,6 +578,12 @@ # error "__cpp_implicit_move != 202207" #endif +#ifndef __cpp_auto_cast +# error "__cpp_auto_cast" +#elif __cpp_auto_cast != 202110 +# error "__cpp_auto_cast != 202110" +#endif + // C++23 attributes: #ifdef __has_cpp_attribute |