April 14, 2014
https://issues.dlang.org/show_bug.cgi?id=12579

          Issue ID: 12579
           Summary: DMD rejects valid function literal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody@puremagic.com
          Reporter: brian-schott@cox.net

>From the grammar documentation:

Decl:
    StorageClasses(opt) BasicType Declarator FunctionBody

DMD rejects the following code:

void function() foo {};

and accepts the following:

void function() foo = {};

According to the grammar spec, the latter should be parsed as a variable declaration whose type is "void function()", with a name of "foo" and an empty struct initializer. (By the way, the grammar does not allow empty struct initializers). This should not pass semantic analysis because a struct literal is not of type void function().

--