[Issue 21619] New: Parameter-less function literal in expression statement fails to parse
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Feb  9 03:45:46 UTC 2021
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21619
          Issue ID: 21619
           Summary: Parameter-less function literal in expression
                    statement fails to parse
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com
Example program:
---
void main()
{
    { assert(true); }();
}
---
Output from DMD 2.095.0:
---
bug.d(3): Error: expression expected, not )
bug.d(3): Error: found ; when expecting )
bug.d(4): Error: found } when expecting ; following statement
bug.d(5): Error: found End of File when expecting } following compound
statement
---
According to the language spec, line 3 should be parsed as an
ExpressionStatement.
--
    
    
More information about the Digitalmars-d-bugs
mailing list