From: Jason Merrill Date: Thu, 6 Aug 2015 14:26:18 +0000 (-0400) Subject: re PR c++/67130 (ICE: tree check: expected identifier_node, have template_decl in... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c1153c1987ba906a8763a0c0de49fe2e6b3937f0;p=gcc.git re PR c++/67130 (ICE: tree check: expected identifier_node, have template_decl in write_unqualified_id, at cp/mangle.c:1218) PR c++/67130 PR c++/67131 PR c++/66260 * mangle.c (write_expression) [TEMPLATE_ID_EXPR]: Handle variable templates. * pt.c (tsubst_copy_and_build): Check for argument substitution failure. From-SVN: r226676 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 986b942f400..e8d45dc7ce6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2015-08-06 Jason Merrill + + PR c++/67130 + PR c++/67131 + PR c++/66260 + * mangle.c (write_expression) [TEMPLATE_ID_EXPR]: Handle variable + templates. + * pt.c (tsubst_copy_and_build): Check for argument substitution + failure. + 2015-08-05 Jason Merrill * pt.c (determine_specialization): Print candidates after 'no diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index d471f4f0a06..4518f20cc8e 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2822,7 +2822,9 @@ write_expression (tree expr) { tree fn = TREE_OPERAND (expr, 0); if (is_overloaded_fn (fn)) - fn = DECL_NAME (get_first_fn (fn)); + fn = get_first_fn (fn); + if (DECL_P (fn)) + fn = DECL_NAME (fn); if (IDENTIFIER_OPNAME_P (fn)) write_string ("on"); write_unqualified_id (fn); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 08fb2ffb431..c3bafd3d37c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14752,6 +14752,8 @@ tsubst_copy_and_build (tree t, if (targs) targs = tsubst_template_args (targs, args, complain, in_decl); + if (targs == error_mark_node) + return error_mark_node; if (variable_template_p (templ)) { diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ42.C b/gcc/testsuite/g++.dg/cpp1y/var-templ42.C new file mode 100644 index 00000000000..a43149d9b55 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ42.C @@ -0,0 +1,17 @@ +// PR c++/67131 +// { dg-do compile { target c++14 } } + +template typename T::_ type; +template