From: Jakub Jelinek Date: Tue, 20 Sep 2016 15:17:41 +0000 (+0200) Subject: re PR c++/77638 (ICE on x86_64-linux-gnu (internal compiler error: tree check: expect... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eaf1ece1315e4fc7356e9fb24e07c4bd86c73f14;p=gcc.git re PR c++/77638 (ICE on x86_64-linux-gnu (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in cp_parser_template_declaration_after_parameters, at cp/parser.c:25722)) PR c++/77638 * parser.c (cp_parser_template_declaration_after_parameter): For 2 argument operator"" template set ok to false for parm == error_mark_node. * g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test. From-SVN: r240266 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 35ad431723d..5efc79522be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2016-09-20 Jakub Jelinek + PR c++/77638 + * parser.c (cp_parser_template_declaration_after_parameter): For 2 + argument operator"" template set ok to false for + parm == error_mark_node. + PR c++/77637 * parser.c (cp_parser_std_attribute_list): Reject ... without preceding attribute. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9a20a5f0945..168486c741c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -25723,7 +25723,8 @@ cp_parser_template_declaration_after_parameters (cp_parser* parser, tree type = INNERMOST_TEMPLATE_PARMS (parm_type); tree parm_list = TREE_VEC_ELT (parameter_list, 1); tree parm = INNERMOST_TEMPLATE_PARMS (parm_list); - if (TREE_TYPE (parm) != TREE_TYPE (type) + if (parm == error_mark_node + || TREE_TYPE (parm) != TREE_TYPE (type) || !TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))) ok = false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4524f062e3..8ffa014add7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-09-20 Jakub Jelinek + PR c++/77638 + * g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test. + PR c++/77637 * g++.dg/cpp0x/gen-attrs-62.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C b/gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C new file mode 100644 index 00000000000..c426e0e4d85 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C @@ -0,0 +1,7 @@ +// PR c++/77638 +// { dg-do compile { target c++11 } } + +template // { dg-error "'T' has not been declared" } +int operator"" _foo (); // { dg-error "has invalid parameter list" } +template // { dg-error "'T' has not been declared" } +int operator"" _bar (); // { dg-error "has invalid parameter list" }