www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21619] New: Parameter-less function literal in expression


          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 puremagic.com
          Reporter: snarwin+bugzilla 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

According to the language spec, line 3 should be parsed as an

Feb 08 2021