C++ PATCH for c++/47721 (N1791, friend T)

Submitted by Jason Merrill on May 27, 2011, 3:58 a.m.

Details

Message ID 4DDF2180.9050408@redhat.com
State New
Headers show

Commit Message

Jason Merrill May 27, 2011, 3:58 a.m.
And as a prerequisite for that testcase, I needed to implement DR 1004, 
dropping the pedwarn about using an injected class name as a template 
template parameter.

Tested x86_64-pc-linux-gnu, applying to trunk.

Patch hide | download patch | download mbox

commit 0407c6ff58d0e7033de64040ce66d60a85b709e5
Author: Jason Merrill <jason@redhat.com>
Date:   Thu May 26 15:00:08 2011 -0400

    	DR 1004
    	* pt.c (convert_template_argument): Don't complain about using
    	injected-class-name as template template argument.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3b26700..28c82b8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5962,7 +5962,9 @@  convert_template_argument (tree parm,
       tree t = maybe_get_template_decl_from_type_decl (TYPE_NAME (arg));
       if (TREE_CODE (t) == TEMPLATE_DECL)
 	{
-	  if (complain & tf_warning_or_error)
+	  if (cxx_dialect >= cxx0x)
+	    /* OK under DR 1004.  */;
+	  else if (complain & tf_warning_or_error)
 	    pedwarn (input_location, OPT_pedantic, "injected-class-name %qD"
 		     " used as template template argument", TYPE_NAME (arg));
 	  else if (flag_pedantic_errors)