PR c++/92450 - ICE with invalid nested name specifier.

* parser.c (cp_parser_member_declaration): Don't attempt to print
	erroneous bit-field diagnostic if grokdeclarator returns
	error_mark_node.

	* g++.dg/parse/crash71.C: New test.

From-SVN: r278570
This commit is contained in:
Marek Polacek 2019-11-21 15:27:46 +00:00 committed by Marek Polacek
parent 7c6f2fb9c7
commit 523cfd52a2
4 changed files with 27 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2019-11-21 Marek Polacek <polacek@redhat.com>
PR c++/92450 - ICE with invalid nested name specifier.
* parser.c (cp_parser_member_declaration): Don't attempt to print
erroneous bit-field diagnostic if grokdeclarator returns
error_mark_node.
2019-11-21 Jakub Jelinek <jakub@redhat.com>
Jason Merrill <jason@redhat.com>

View file

@ -25062,9 +25062,10 @@ cp_parser_member_declaration (cp_parser* parser)
tree d = grokdeclarator (declarator, &decl_specifiers,
BITFIELD, /*initialized=*/false,
&attributes);
error_at (DECL_SOURCE_LOCATION (d),
"bit-field %qD has non-integral type %qT",
d, TREE_TYPE (d));
if (!error_operand_p (d))
error_at (DECL_SOURCE_LOCATION (d),
"bit-field %qD has non-integral type %qT",
d, TREE_TYPE (d));
cp_parser_skip_to_end_of_statement (parser);
/* Avoid "extra ;" pedwarns. */
if (cp_lexer_next_token_is (parser->lexer,

View file

@ -1,3 +1,8 @@
2019-11-21 Marek Polacek <polacek@redhat.com>
PR c++/92450 - ICE with invalid nested name specifier.
* g++.dg/parse/crash71.C: New test.
2019-11-21 Wilco Dijkstra <wdijkstr@arm.com>
* gfortran.dg/global_vars_f90_init_driver.c: Add missing extern.

View file

@ -0,0 +1,11 @@
// PR c++/92450 - ICE with invalid nested name specifier.
typedef int C2;
struct B1 {
struct B2 {
};
};
struct S6g {
C2 : B1:B2; // { dg-error "" }
};