[Issue 15620] New: Use of FunctionLiteralBody grammar rule is not allowed by the compiler

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 28 23:36:36 PST 2016


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: nobody at puremagic.com
          Reporter: briancschott at 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?

--


More information about the Digitalmars-d-bugs mailing list