From: Jason Merrill Date: Thu, 22 Dec 2016 15:19:54 +0000 (-0500) Subject: PR c++/78898 - ICE on constructor with TTP X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd809fdeca8088bb91e6414d834e3e322dcdf14c;p=gcc.git PR c++/78898 - ICE on constructor with TTP PR c++/42329 * pt.c (unify): Don't look for a class template from a non-class. From-SVN: r243890 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 925d0b519bf..6f193c4e2db 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-12-22 Jason Merrill + + PR c++/78898 + PR c++/42329 + * pt.c (unify): Don't look for a class template from a non-class. + 2016-12-21 Jakub Jelinek PR c++/72707 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 301eb5271ba..7711546f7b7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20292,7 +20292,8 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, if (TREE_CODE (parm) == BOUND_TEMPLATE_TEMPLATE_PARM) { - if (strict_in & UNIFY_ALLOW_DERIVED) + if ((strict_in & UNIFY_ALLOW_DERIVED) + && CLASS_TYPE_P (arg)) { /* First try to match ARG directly. */ tree t = try_class_unification (tparms, targs, parm, arg, diff --git a/gcc/testsuite/g++.dg/template/ttp30.C b/gcc/testsuite/g++.dg/template/ttp30.C new file mode 100644 index 00000000000..f7b9ce7bfbc --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ttp30.C @@ -0,0 +1,6 @@ +// PR c++/78898 + +struct A { + template A(T); + template