On 11/1/19 3:57 PM, Jakub Jelinek wrote:
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.
It isn't accepted for me:
wa3.C: In function 'void foo()':
wa3.C:4:29: warning: attribute ignored [-Wattributes]
4 | auto a = [] () [[noreturn]] constexpr {};
| ^
wa3.C:4:29: note: an attribute that appertains to a type-specifier is
ignored
wa3.C: In lambda function:
wa3.C:4:31: error: expected '{' before 'constexpr'
4 | auto a = [] () [[noreturn]] constexpr {};
| ^~~~~~~~~
wa3.C: In function 'void foo()':
wa3.C:4:31: error: expected ',' or ';' before 'constexpr'
wa3.C: In lambda function:
wa3.C:5:44: error: expected '{' before 'constexpr'
5 | auto b = [] () __attribute__((noreturn)) constexpr {};
| ^~~~~~~~~
wa3.C: In function 'void foo()':
wa3.C:5:44: error: expected ',' or ';' before 'constexpr'
Moving constexpr before the attributes makes it compile.
The code should handle mutable consteval, as mutable is a keyword and it
will just keep looking after that keyword.
Ah, right.
Jason