re PR c++/55232 ([C++11] ICE with -Wunused-parameter for unused parameter pack using...
authorJason Merrill <jason@redhat.com>
Fri, 15 Feb 2013 01:26:34 +0000 (20:26 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 15 Feb 2013 01:26:34 +0000 (20:26 -0500)
PR c++/55232
* error.c (find_typenames_r): Don't walk into a pack expansion.

From-SVN: r196064

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C [new file with mode: 0644]

index 033aa1ec066a25294a42dc60150c689a20e7812c..4784a3cf8393b8b4456fae07867256b9a6868927 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/55232
+       * error.c (find_typenames_r): Don't walk into a pack expansion.
+
 2013-02-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/55670
index a4b3320dfef7096fa5763c73102a95694382da36..60119ec6302a4e77eccced8280c94380c30a95d3 100644 (file)
@@ -1283,7 +1283,7 @@ struct find_typenames_t
 };
 
 static tree
-find_typenames_r (tree *tp, int * /*walk_subtrees*/, void *data)
+find_typenames_r (tree *tp, int *walk_subtrees, void *data)
 {
   struct find_typenames_t *d = (struct find_typenames_t *)data;
   tree mv = NULL_TREE;
@@ -1296,6 +1296,14 @@ find_typenames_r (tree *tp, int * /*walk_subtrees*/, void *data)
     /* Add the typename without any cv-qualifiers.  */
     mv = TYPE_MAIN_VARIANT (*tp);
 
+  if (TREE_CODE (*tp) == TYPE_PACK_EXPANSION)
+    {
+      /* Don't mess with parameter packs since we don't remember
+        the pack expansion context for a particular typename.  */
+      *walk_subtrees = false;
+      return NULL_TREE;
+    }
+
   if (mv && (mv == *tp || !pointer_set_insert (d->p_set, mv)))
     vec_safe_push (d->typenames, mv);
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C
new file mode 100644 (file)
index 0000000..53182d3
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/55232
+// { dg-do compile { target c++11 } }
+
+struct vector
+{
+    typedef int value_type;
+};
+
+template< class U, class... T >
+struct X
+{
+    void push_back( typename T::value_type ... vals )
+    {
+      U::asoeuth;              // { dg-error "" }
+    }
+};
+
+int main()
+{
+  X< int, vector > x;
+  x.push_back( 0 );
+}