[Issue 12579] New: DMD rejects valid function literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 14 10:28:14 PDT 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 at puremagic.com
Reporter: brian-schott at 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().
--
More information about the Digitalmars-d-bugs
mailing list