diff mbox series

[pushed] C++ : Remove an overzealous checking assert [PR97871]

Message ID EFCC008F-BBA2-417C-ADE6-6FCD8C985189@sandoe.co.uk
State New
Headers show
Series [pushed] C++ : Remove an overzealous checking assert [PR97871] | expand

Commit Message

Iain Sandoe Nov. 17, 2020, 4:58 p.m. UTC
Hi,

This amends my commit from r11-4927 to remove an assert.

tested on x86_64-darwin,
pushed to master
Iain

-------

It seems we accept __attribute__(()) without any diagnostic at present,
so my added checking assert fires for something like:

__attribute__ (()) int a;

Fixed by removing the assert; in the case that the user enters something
like:

__attribute__ (()) extern "C" int foo;

The diagnostic about attributes before linkage specs will fire and show
the empty attributes.

gcc/cp/ChangeLog:

	PR c++/97871
	* parser.c (cp_parser_declaration): Remove checking assert.
---
  gcc/cp/parser.c | 1 -
  1 file changed, 1 deletion(-)

  		      ? t1 : cp_lexer_peek_nth_token (parser->lexer, 2));
diff mbox series

Patch

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 42f705266bb..b7ef259b048 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13536,7 +13536,6 @@  cp_parser_declaration (cp_parser* parser, tree  
prefix_attrs)
      {
        cp_lexer_save_tokens (parser->lexer);
        attributes = cp_parser_attributes_opt (parser);
-      gcc_checking_assert (attributes);
        cp_token *t1 = cp_lexer_peek_token (parser->lexer);
        cp_token *t2 = (t1->type == CPP_EOF