On Fri, Nov 01, 2019 at 03:42:58PM -0400, Jason Merrill wrote: > > + for (size_t n = cp_parser_skip_balanced_tokens (parser, 1); ; n++) > > + { > > + size_t after = cp_parser_skip_attributes_opt (parser, n); > > + if (after > n) > > + { > > + n = after - 1; > > + continue; > > + } > > You don't need to skip attributes, the decl-specifiers come immediately > after the ).
void foo () { auto a = [] () [[noreturn]] constexpr {}; auto b = [] () __attribute__((noreturn)) constexpr {}; auto c = [] () mutable constexpr {}; } (using constexpr instead of consteval to be able to test it without my patch) is certainly accepted, not sure if that is conforming or not. The grammar has decl-specifier-seq[opt] after the ) in lambda-declarator and decl-specifier-seq: decl-specifier attribute-specifier-seq[opt] decl-specifier decl-specifier-seq so I'd say attribute-specifier-seq is only allowed at the very end of the decl-specifier-seq, so maybe we have an accepts-invalid bug, but the grammar doesn't cover the GNU attributes anyway. > > OK with that change. > > > + if (!cp_lexer_nth_token_is (parser->lexer, n, CPP_KEYWORD)) > > + break; > > + if (cp_lexer_peek_nth_token (parser->lexer, n)->keyword > > + == RID_CONSTEVAL) > > I suppose it's reasonable to not consider "mutable consteval" here. :) > > > + { > > + is_consteval = true; > > + break; > > + } The code should handle mutable consteval, as mutable is a keyword and it will just keep looking after that keyword. Jakub