From a30d0196379064ed2b24c6d405ffeb6b72b9a281 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 14 Jan 2019 21:12:11 +0100 Subject: [PATCH] c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto. * c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto. Add a comment that __cpp_template_auto is deprecated. * g++.dg/cpp1z/feat-cxx1z.C: Add tests for __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto feature test macros. * g++.dg/cpp2a/feat-cxx2a.C: Likewise. From-SVN: r267925 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-cppbuiltin.c | 4 ++++ gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C | 12 ++++++++++++ gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C | 12 ++++++++++++ 5 files changed, 41 insertions(+) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 0ff16ab4a3f..10e5cc131e9 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2019-01-14 Jakub Jelinek + + * c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision + and __cpp_nontype_template_parameter_auto. Add a comment that + __cpp_template_auto is deprecated. + 2019-01-14 Tom Honermann Implement P0482R5, char8_t: A type for UTF-8 characters and strings diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index c9b63caeb2d..d389f8ca4a0 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -974,9 +974,13 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__cpp_aggregate_bases=201603"); cpp_define (pfile, "__cpp_deduction_guides=201703"); cpp_define (pfile, "__cpp_noexcept_function_type=201510"); + /* Old macro, superseded by + __cpp_nontype_template_parameter_auto. */ cpp_define (pfile, "__cpp_template_auto=201606"); cpp_define (pfile, "__cpp_structured_bindings=201606"); cpp_define (pfile, "__cpp_variadic_using=201611"); + cpp_define (pfile, "__cpp_guaranteed_copy_elision=201606"); + cpp_define (pfile, "__cpp_nontype_template_parameter_auto=201606"); } if (cxx_dialect > cxx17) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d207a519372..13bb87208a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-01-14 Jakub Jelinek + + * g++.dg/cpp1z/feat-cxx1z.C: Add tests for + __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto + feature test macros. + * g++.dg/cpp2a/feat-cxx2a.C: Likewise. + 2019-01-14 Marek Polacek PR c++/88830 - ICE with abstract class. diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C index f551892a045..da372dca8cb 100644 --- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C +++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C @@ -417,6 +417,18 @@ # error "__cpp_variadic_using != 201611" #endif +#ifndef __cpp_guaranteed_copy_elision +# error "__cpp_guaranteed_copy_elision" +#elif __cpp_guaranteed_copy_elision != 201606 +# error "__cpp_guaranteed_copy_elision != 201606" +#endif + +#ifndef __cpp_nontype_template_parameter_auto +# error "__cpp_nontype_template_parameter_auto" +#elif __cpp_nontype_template_parameter_auto != 201606 +# error "__cpp_nontype_template_parameter_auto != 201606" +#endif + #ifdef __has_cpp_attribute # if ! __has_cpp_attribute(maybe_unused) diff --git a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C index 8e1ea48bb1d..8ee7b82914b 100644 --- a/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C +++ b/gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C @@ -416,6 +416,18 @@ # error "__cpp_variadic_using != 201611" #endif +#ifndef __cpp_guaranteed_copy_elision +# error "__cpp_guaranteed_copy_elision" +#elif __cpp_guaranteed_copy_elision != 201606 +# error "__cpp_guaranteed_copy_elision != 201606" +#endif + +#ifndef __cpp_nontype_template_parameter_auto +# error "__cpp_nontype_template_parameter_auto" +#elif __cpp_nontype_template_parameter_auto != 201606 +# error "__cpp_nontype_template_parameter_auto != 201606" +#endif + // C++20 features #if __cpp_conditional_explicit != 201806 -- 2.30.2