aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2007-12-04 21:12:41 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2007-12-04 21:12:41 +0000
commitba7963084ebe2ee2302c97a2aa70d919516311a3 (patch)
treeceff35d1296e28906021887227416b270f31a7f7
parent3d57f0f08572758a796bffe8776703c9cf16ea75 (diff)
downloadgcc-ba7963084ebe2ee2302c97a2aa70d919516311a3.zip
gcc-ba7963084ebe2ee2302c97a2aa70d919516311a3.tar.gz
gcc-ba7963084ebe2ee2302c97a2aa70d919516311a3.tar.bz2
re PR c++/34101 (ICE with argument deduction of variadic template function)
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
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/name-lookup.c20
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-ttp.C12
4 files changed, 36 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f694c88..0ade8cd 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,13 @@
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
* pt.c (tsubst_exception_specification): Handle substitutions into
member templates, where tsubst_pack_expansion returns a
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index a7bb710..98c866f 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -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 ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a4fc563..5407e15 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..41f1c1d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp.C
@@ -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>());
+}