re PR c++/27425 (ICE with invalid template-template-parameter)
authorJason Merrill <jason@redhat.com>
Fri, 13 Nov 2009 18:46:47 +0000 (13:46 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 13 Nov 2009 18:46:47 +0000 (13:46 -0500)
PR c++/27425
PR c++/34274
* pt.c (expand_template_argument_pack): Handle null arg gracefully.
(convert_template_argument): Use %T for type.

From-SVN: r154164

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/arg7.C [new file with mode: 0644]

index 722c983..d5dc053 100644 (file)
@@ -1,5 +1,10 @@
 2009-11-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/27425
+       PR c++/34274
+       * pt.c (expand_template_argument_pack): Handle null arg gracefully.
+       (convert_template_argument): Use %T for type.
+
        PR c++/29363
        * decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here.
        (cxx_init_decl_processing): Not here.
index 540f577..b7d72c1 100644 (file)
@@ -3150,6 +3150,8 @@ expand_template_argument_pack (tree args)
   for (in_arg = 0; in_arg < nargs; ++in_arg)
     {
       tree arg = TREE_VEC_ELT (args, in_arg);
+      if (arg == NULL_TREE)
+       return args;
       if (ARGUMENT_PACK_P (arg))
         {
           int num_packed = TREE_VEC_LENGTH (ARGUMENT_PACK_ARGS (arg));
@@ -5472,7 +5474,7 @@ convert_template_argument (tree parm,
                      error ("type/value mismatch at argument %d in "
                             "template parameter list for %qD",
                             i + 1, in_decl);
-                     error ("  expected a template of type %qD, got %qD",
+                     error ("  expected a template of type %qD, got %qT",
                             parm, orig_arg);
                    }
 
index 9149067..e26d705 100644 (file)
@@ -1,5 +1,9 @@
 2009-11-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/27425
+       PR c++/34274
+       * g++.dg/template/arg7.C: New.
+
        PR c++/29363
        * g++.dg/template/error43.C: New.
 
diff --git a/gcc/testsuite/g++.dg/template/arg7.C b/gcc/testsuite/g++.dg/template/arg7.C
new file mode 100644 (file)
index 0000000..a9333b2
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/27425, 34274
+
+template<typename T> struct A
+{
+  template<template<T> class> struct B {}; // { dg-error "void|mismatch|expected" }
+  // { dg-bogus "not supported" "" { target *-*-* } 5 }
+  template<T> struct C;                           // { dg-error "void" }
+  B<C> b;
+};
+
+A<void> a;                     // { dg-message "instantiated" }