[Issue 24525] auto ref lambda exp not parsed if used as left-most expression in a expression statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 28 18:30:11 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24525

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org
           Severity|normal                      |enhancement

--- Comment #1 from Nick Treleaven <nick at geany.org> ---
Under https://dlang.org/spec/statement.html#NonEmptyStatementNoCaseNoDefault
grammar block it says:

> Any ambiguities in the grammar between Statements and Declarations are resolved by the declarations taking precedence. 

For:
> ref () {return a;}() = 0;

A declaration `ref () {return a;}` gets parsed, not an ExpressionStatement. So
I think this issue is invalid.

It is unfortunate that the function literal syntax starting `ref` or `auto ref`
was added, when the function/delegate keyword starting forms can already handle
those.

--


More information about the Digitalmars-d-bugs mailing list