From: Patrick Palka Date: Wed, 1 Jul 2015 01:07:35 +0000 (+0000) Subject: Fix PR c++/66686 (dependent template template substitution) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f58d5e069d601551cbc072919789e46f7fe3c77d;p=gcc.git Fix PR c++/66686 (dependent template template substitution) gcc/cp/ChangeLog: PR c++/66686 * pt.c (coerce_template_template_parm) [PARM_DECL]: Don't return 0 if tsubst returns a dependent type. gcc/testsuite/ChangeLog: PR c++/66686 * g++.dg/template/pr66686.C: New test. From-SVN: r225220 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4d9b5a68cc4..e3436418259 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-07-01 Patrick Palka + + PR c++/66686 + * pt.c (coerce_template_template_parm) [PARM_DECL]: Don't + return 0 if tsubst returns a dependent type. + 2015-06-30 Jason Merrill PR debug/66653 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6b73d49ce29..38d2e3a24e3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6363,11 +6363,13 @@ coerce_template_template_parm (tree parm, D d; i.e. the parameter list of TT depends on earlier parameters. */ - if (!uses_template_parms (TREE_TYPE (arg)) - && !same_type_p - (tsubst (TREE_TYPE (parm), outer_args, complain, in_decl), - TREE_TYPE (arg))) - return 0; + if (!uses_template_parms (TREE_TYPE (arg))) + { + tree t = tsubst (TREE_TYPE (parm), outer_args, complain, in_decl); + if (!uses_template_parms (t) + && !same_type_p (t, TREE_TYPE (arg))) + return 0; + } if (TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (arg)) && !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fc634abefd..aca88862aa9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-01 Patrick Palka + + PR c++/66686 + * g++.dg/template/pr66686.C: New test. + 2015-06-30 Eric Botcazou * gnat.dg/lto17.ad[sb]: New test. diff --git a/gcc/testsuite/g++.dg/template/pr66686.C b/gcc/testsuite/g++.dg/template/pr66686.C new file mode 100644 index 00000000000..d8aea625d46 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr66686.C @@ -0,0 +1,15 @@ +// PR c++/66686 + +template +struct Y { }; + +template class Z> class C> +struct X +{ + C a; // { dg-bogus "mismatch" } +}; + +template