diff mbox

C++ PATCH for c++/42329, P0522 and other template template parm issues

Message ID CADzB+2mc9+NOyDfk0zHab+=Y4VdR8m58tjP-zPebc4Ls_6t+2w@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill Dec. 22, 2016, 8:27 p.m. UTC
On Wed, Dec 21, 2016 at 4:06 PM, Jason Merrill <jason@redhat.com> wrote:
> The last patch implements paper P0522, which resolves DR150 to clarify
> that default arguments do make a template suitable as an argument to a
> template template-parameter based on a new rule that the
> template-parameter must be more specialized (as newly defined) than
> the argument template.  This is a defect report that will apply to all
> standard levels, but since we're in stage3 I limited it by default to
> C++17 for GCC 7; it can also be explicitly enabled with
> -fnew-ttp-matching.

And this adds a feature-test macro I proposed to SG10.
commit 2396126078c49cc17dacc905969febd1bdd7caa6
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Dec 22 13:11:26 2016 -0500

    Feature-test macro for P0522R0, matching of template template arguments.
    
            * c-cppbuiltin.c (c_cpp_builtins): Define
            __cpp_template_template_args.
diff mbox

Patch

diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index e2419e8..a841e53 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -985,6 +985,8 @@  c_cpp_builtins (cpp_reader *pfile)
 	  cpp_define_formatted (pfile, "__STDCPP_DEFAULT_NEW_ALIGNMENT__=%d",
 				aligned_new_threshold);
 	}
+      if (flag_new_ttp)
+	cpp_define (pfile, "__cpp_template_template_args=201611");
     }
   /* Note that we define this for C as well, so that we know if
      __attribute__((cleanup)) will interface with EH.  */
diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
index 086fd25..f61b9f5 100644
--- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
+++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
@@ -398,6 +398,12 @@ 
 #  error "__cpp_structured_bindings != 201606"
 #endif
 
+#ifndef __cpp_template_template_args
+#  error "__cpp_template_template_args"
+#elif __cpp_template_template_args != 201611
+#  error "__cpp_template_template_args != 201611"
+#endif
+
 #ifdef __has_cpp_attribute
 
 #  if ! __has_cpp_attribute(maybe_unused)