May 14, 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@puremagic.com
          Reporter: b2.temp@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.

--