[Issue 19869] New: `PrimaryExpression` allows incorrect forms of function literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 14 00:32:38 UTC 2019


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

          Issue ID: 19869
           Summary: `PrimaryExpression` allows incorrect forms of function
                    literals
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

https://dlang.org/spec/expression.html#FunctionLiteralBody

PrimaryExpression:
   ...
   FunctionLiteral

FunctionLiteral:
   ...
   FunctionLiteralBody

FunctionLiteralBody:
    ...
    FunctionContractsopt BodyStatement

Says that

   auto b = do {return true;}();

Is valid, which is not. Maybe It says that

   auto a = in{assert(true);} do {return true;}();

would be correct but it's not either. 

Note that in the rules BodyStatement is not a valid one. Its target anchor does
not exist.

--


More information about the Digitalmars-d-bugs mailing list