public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] C++ : Remove an overzealous checking assert [PR97871]
@ 2020-11-17 16:58 Iain Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain Sandoe @ 2020-11-17 16:58 UTC (permalink / raw)
  To: GCC Patches

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(-)

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
  		      ? t1 : cp_lexer_peek_nth_token (parser->lexer, 2));
-- 
2.24.1



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-17 16:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 16:58 [pushed] C++ : Remove an overzealous checking assert [PR97871] Iain Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).