From 7beb51f914e5f5930c279aab88597a39597064a6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 1 Feb 2019 09:42:01 +0100 Subject: [PATCH] re PR c++/87175 (__attribute__)) is ignored by the parser) PR c++/87175 * parser.c (cp_parser_gnu_attributes_opt): Set ok to false if require_open failed. * g++.dg/ext/attrib57.C: New test. From-SVN: r268443 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 6 ++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ext/attrib57.C | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/attrib57.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2a2aba3ad44..ca3618ee060 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-02-01 Jakub Jelinek + + PR c++/87175 + * parser.c (cp_parser_gnu_attributes_opt): Set ok to false + if require_open failed. + 2019-01-31 Marek Polacek PR c++/89083, c++/80864 - ICE with list initialization in template. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 16f2a32bc0b..91c5ff42fad 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -25768,9 +25768,11 @@ cp_parser_gnu_attributes_opt (cp_parser* parser) cp_lexer_consume_token (parser->lexer); /* Look for the two `(' tokens. */ matching_parens outer_parens; - outer_parens.require_open (parser); + if (!outer_parens.require_open (parser)) + ok = false; matching_parens inner_parens; - inner_parens.require_open (parser); + if (!inner_parens.require_open (parser)) + ok = false; /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2bf2433529c..520ee15d764 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-01 Jakub Jelinek + + PR c++/87175 + * g++.dg/ext/attrib57.C: New test. + 2018-02-01 Bin Cheng PR tree-optimization/88932 diff --git a/gcc/testsuite/g++.dg/ext/attrib57.C b/gcc/testsuite/g++.dg/ext/attrib57.C new file mode 100644 index 00000000000..7631f12ab31 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib57.C @@ -0,0 +1,6 @@ +// PR c++/87175 +// { dg-do compile } +// { dg-options "" } + +struct __attribute__)) foo { }; // { dg-error "expected" } +struct __attribute__()) bar { };// { dg-error "expected" } -- 2.30.2