From: Jason Merrill Date: Wed, 28 Jun 2017 19:59:37 +0000 (-0400) Subject: PR c++/72801 - ICE with variadic partial specialization X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d778c63739f59f83f47973a4f02a7f86ac74a3e7;p=gcc.git PR c++/72801 - ICE with variadic partial specialization * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS. From-SVN: r249755 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f4b93ca7d10..ae6de7f009c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-06-28 Jason Merrill + PR c++/72801 - ICE with variadic partial specialization + * pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS. + PR c++/55639 - partial specialization with ::template * parser.c (cp_parser_class_head): Handle ::template. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b060a190946..b86b346164d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20044,6 +20044,9 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, tree pack, packs = NULL_TREE; int i, start = TREE_VEC_LENGTH (packed_parms) - 1; + /* Add in any args remembered from an earlier partial instantiation. */ + targs = add_to_template_args (PACK_EXPANSION_EXTRA_ARGS (parm), targs); + packed_args = expand_template_argument_pack (packed_args); int len = TREE_VEC_LENGTH (packed_args); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C new file mode 100644 index 00000000000..6f8df3e1aaf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C @@ -0,0 +1,22 @@ +// PR c++/72801 +// { dg-do compile { target c++11 } } + +template < typename, typename > struct A {}; + +template < typename ... T > struct B +{ + template < typename > struct C + { + static const int a = 0; + }; + + template < typename R, typename ... S > + struct C < R (A < T, S > ...) > + { + static const int a = 1; + }; +}; + +#define SA(X) static_assert ((X), #X) +SA(B <>::C::a == 1); +