From 1f258a55a9df39ecef35d0049c3bf703d6cdbe53 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 11 Jan 2017 19:09:58 +0100 Subject: [PATCH] re PR c++/78341 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: in cp_parser_std_attribute_spec, at cp/parser.c:24597)) PR c++/78341 * parser.c (cp_parser_std_attribute_spec): Remove over-eager assertion. Formatting fix. * g++.dg/cpp0x/pr78341.C: New test. From-SVN: r244329 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/parser.c | 6 +----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/pr78341.C | 4 ++++ 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr78341.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2b229f2aae7..6ae85ae6c7d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-01-11 Jakub Jelinek + PR c++/78341 + * parser.c (cp_parser_std_attribute_spec): Remove over-eager + assertion. Formatting fix. + PR c++/72813 * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after writing PCH file. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7b3ee30345e..295c450507d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -24925,11 +24925,7 @@ cp_parser_std_attribute_spec (cp_parser *parser) if (!cp_parser_parse_definitely (parser)) { - gcc_assert (alignas_expr == error_mark_node - || alignas_expr == NULL_TREE); - - alignas_expr = - cp_parser_assignment_expression (parser); + alignas_expr = cp_parser_assignment_expression (parser); if (alignas_expr == error_mark_node) cp_parser_skip_to_end_of_statement (parser); if (alignas_expr == NULL_TREE diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bd56e7bcefb..4df8d41da99 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-11 Jakub Jelinek + + PR c++/78341 + * g++.dg/cpp0x/pr78341.C: New test. + 2017-01-11 Martin Sebor PR c/78768 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78341.C b/gcc/testsuite/g++.dg/cpp0x/pr78341.C new file mode 100644 index 00000000000..af906384098 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr78341.C @@ -0,0 +1,4 @@ +// PR c++/78341 +// { dg-do compile { target c++11 } } + +alignas (alignas double // { dg-error "" } -- 2.30.2