c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision and __cpp_nontyp...
authorJakub Jelinek <jakub@redhat.com>
Mon, 14 Jan 2019 20:12:11 +0000 (21:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 14 Jan 2019 20:12:11 +0000 (21:12 +0100)
* 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
gcc/c-family/c-cppbuiltin.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C

index 0ff16ab4a3fce4e0fa57f73e3a3a6a139a599191..10e5cc131e980b240a282a66a3a6e33657d61be9 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * 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  <tom@honermann.net>
 
        Implement P0482R5, char8_t: A type for UTF-8 characters and strings
index c9b63caeb2db186300f145051432f754e3d27485..d389f8ca4a02651ee899185fcd3bdfdf4d0393b2 100644 (file)
@@ -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)
        {
index d207a5193729dff8d09d8405e1fd4e2698512cd7..13bb87208a04d45598ee816c638d3aa09b473fc0 100644 (file)
@@ -1,3 +1,10 @@
+2019-01-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * 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  <polacek@redhat.com>
 
        PR c++/88830 - ICE with abstract class.
index f551892a045d1fdbc99c4f0610cd3d3e1909339d..da372dca8cb1ca7aac34d144dcb3a623a34a1d11 100644 (file)
 #  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)
index 8e1ea48bb1d6d9039e4c824e78a15af3e719fc4e..8ee7b82914b5fc51a43a23ae2a7795f661e02100 100644 (file)
 #  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