PR c++/55232
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Feb 2013 01:26:34 +0000 (01:26 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Feb 2013 01:26:34 +0000 (01:26 +0000)
* error.c (find_typenames_r): Don't walk into a pack expansion.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196064 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 033aa1e..4784a3c 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 a4b3320..60119ec 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 );
+}