]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/34101 (ICE with argument deduction of variadic template function)
authorDouglas Gregor <doug.gregor@gmail.com>
Tue, 4 Dec 2007 21:12:41 +0000 (21:12 +0000)
committerDoug Gregor <dgregor@gcc.gnu.org>
Tue, 4 Dec 2007 21:12:41 +0000 (21:12 +0000)
2007-12-04  Douglas Gregor  <doug.gregor@gmail.com>

       PR c++/34101
       * name-lookup.c (arg_assoc_template_arg): Recurse on argument
       packs.
       (arg_assoc_type): We don't need to handle TYPE_ARGUMENT_PACK here,
       since arg_assoc_template_arg will deal with them (better).

2007-12-04  Douglas Gregor  <doug.gregor@gmail.com>

       PR c++/34101
       * g++.dg/cpp0x/variadic-ttp.C: New.

From-SVN: r130608

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

index f694c8866ef673a28ba55048ac684ddbdb7dcfd6..0ade8cded77c6114729674ab25c6e5fda80084cc 100644 (file)
@@ -1,3 +1,11 @@
+2007-12-04  Douglas Gregor  <doug.gregor@gmail.com>
+
+       PR c++/34101
+       * name-lookup.c (arg_assoc_template_arg): Recurse on argument
+       packs.
+       (arg_assoc_type): We don't need to handle TYPE_ARGUMENT_PACK here,
+       since arg_assoc_template_arg will deal with them (better).
+
 2007-12-04  Douglas Gregor  <doug.gregor@gmail.com>
 
        PR c++/33509
index a7bb710dace4b5101c3f5af999226b83cc2ddbd7..98c866f3a19ed18d04fa6f74a79c5777afa5e038 100644 (file)
@@ -4477,6 +4477,17 @@ arg_assoc_template_arg (struct arg_lookup *k, tree arg)
       else
        return arg_assoc_class (k, ctx);
     }
+  /* It's an argument pack; handle it recursively.  */
+  else if (ARGUMENT_PACK_P (arg))
+    {
+      tree args = ARGUMENT_PACK_ARGS (arg);
+      int i, len = TREE_VEC_LENGTH (args);
+      for (i = 0; i < len; ++i) 
+       if (arg_assoc_template_arg (k, TREE_VEC_ELT (args, i)))
+         return true;
+
+      return false;
+    }
   /* It's not a template template argument, but it is a type template
      argument.  */
   else if (TYPE_P (arg))
@@ -4612,15 +4623,6 @@ arg_assoc_type (struct arg_lookup *k, tree type)
       return false;
     case TYPE_PACK_EXPANSION:
       return arg_assoc_type (k, PACK_EXPANSION_PATTERN (type));
-    case TYPE_ARGUMENT_PACK:
-      {
-        tree args = ARGUMENT_PACK_ARGS (type);
-        int i, len = TREE_VEC_LENGTH (args);
-        for (i = 0; i < len; i++)
-          if (arg_assoc_type (k, TREE_VEC_ELT (args, i)))
-            return true;
-      }
-      break;
 
     default:
       gcc_unreachable ();
index a4fc563cbb62fd924c75d728d090f8ccb0f6673b..5407e15f6456a857937fafc797f3bc9b9c63e70a 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-04  Douglas Gregor  <doug.gregor@gmail.com>
+
+       PR c++/34101
+       * g++.dg/cpp0x/variadic-ttp.C: New.
+
 2007-12-04  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
        
        * gcc.dg/parse-decl-after-if.c: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp.C
new file mode 100644 (file)
index 0000000..41f1c1d
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-options -std=c++0x }
+// PR c++/34101
+template<typename> struct A {};
+
+template<template<typename> class...> struct B {};
+
+template<template<typename> class T> void foo(const B<T>&);
+
+void bar()
+{
+  foo(B<A>());
+}
This page took 0.131756 seconds and 5 git commands to generate.