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

          Issue ID: 15620
           Summary: Use of FunctionLiteralBody grammar rule is not allowed
                    by the compiler
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/spec/grammar.html#FunctionLiteral
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nob...@puremagic.com
          Reporter: briancsch...@gmail.com
            Blocks: 10233

unittest
{
    alias abc = in { } out { } body { return 100; };
    alias abc = () in{ } out { } body { return 100; };
    alias abc = () @nogc in{ } out { } body { return 100; };
    doThings(in { } out { } body { return 100; });
    auto a = in { } out { } body { return 100; };
}

All of these are valid according to the grammar due to the way that the
FunctionLiteralBody rule includes optional contracts. The compiler rejects all
of them.

Which is correct, compiler or grammar?

--

Reply via email to