On 12/5/23 12:17, Marek Polacek wrote:
On Tue, Dec 05, 2023 at 06:00:31PM +0100, Jakub Jelinek wrote:
On Tue, Dec 05, 2023 at 09:45:32AM -0500, Marek Polacek wrote:
When working on the previous patch I put [[]] [[]] asm (""); into a
testcase, but was surprised it wasn't parsed.

By wasn't parsed you mean we gave an error, right?  I only see an error
with block-scope [[]] [[]];.

Yeah.
The reason why [[]][[]]; works at namespace scope is that if
   else if (cp_lexer_nth_token_is (parser->lexer,
                                   cp_parser_skip_std_attribute_spec_seq 
(parser,
                                                                          1),
                                   CPP_SEMICOLON))
which is the case here then even if after parsing the attributes next token
isn't CPP_SEMICOLON (the case here without the patch), it will just return
and another cp_parser_declaration will parse another [[]], that time also
with CPP_SEMICOLON.

It seems marginally better to me to use void_list_node so that we don't
need a new parm, like what we do when parsing parameters: ()/(void)/(...),
but I should let others decide.

Here is a modified version of the patch which does it like that.

Thanks, this looks good to me.

Agreed, OK.

Reply via email to