aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-01-17 12:44:35 -0500
committerJason Merrill <jason@gcc.gnu.org>2018-01-17 12:44:35 -0500
commit2625472ffa519e2c544cd9c181ac19cb9724b430 (patch)
treec35736a1e864c369e79023b66b62101883fdf8fd
parent824721f0905478ebc39e6a295cc8e95c22fa9d17 (diff)
downloadgcc-2625472ffa519e2c544cd9c181ac19cb9724b430.zip
gcc-2625472ffa519e2c544cd9c181ac19cb9724b430.tar.gz
gcc-2625472ffa519e2c544cd9c181ac19cb9724b430.tar.bz2
PR c++/81843 - ICE with variadic member template.
PR c++/72801 * pt.c (unify_pack_expansion): Don't try to deduce enclosing template args. From-SVN: r256802
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic171.C12
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ed44be7..ff09fe3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/81843 - ICE with variadic member template.
+ PR c++/72801
+ * pt.c (unify_pack_expansion): Don't try to deduce enclosing
+ template args.
+
2018-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/83799
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 85997e2..3d7d458 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -20370,6 +20370,7 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
/* Add in any args remembered from an earlier partial instantiation. */
targs = add_to_template_args (PACK_EXPANSION_EXTRA_ARGS (parm), targs);
+ int levels = TMPL_ARGS_DEPTH (targs);
packed_args = expand_template_argument_pack (packed_args);
@@ -20385,6 +20386,8 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
/* Determine the index and level of this parameter pack. */
template_parm_level_and_index (parm_pack, &level, &idx);
+ if (level < levels)
+ continue;
/* Keep track of the parameter packs and their corresponding
argument packs. */
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic171.C b/gcc/testsuite/g++.dg/cpp0x/variadic171.C
new file mode 100644
index 0000000..1e26814
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic171.C
@@ -0,0 +1,12 @@
+// PR c++/81843
+// { dg-do compile { target c++11 } }
+
+template < typename > struct A;
+template < typename, typename > struct B;
+template < typename ... S > struct C
+{
+ template < typename > struct D {};
+ template < typename ... T > struct D < A < B < S, T > ... > >;
+};
+
+C <>::D < A < B < int, int > > > c;