[Issue 13523] New: Auto function declaration does not match any grammar rule
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Sep 23 06:26:38 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13523
Issue ID: 13523
Summary: Auto function declaration does not match any grammar
rule
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P1
Component: websites
Assignee: nobody at puremagic.com
Reporter: k.hara.pg at gmail.com
auto foo() {}
It is a function declaration with return type inference, but surprisingly, the
syntax does not match any documented grammar rule.
Decl:
StorageClasses_opt BasicType Declarators ;
StorageClasses_opt BasicType Declarator FunctionBody
--> BasicType is not optional, so cannot match
AutoDeclaration:
StorageClasses AutoDeclarationX ;
AutoDeclarationX:
Identifier TemplateParametersopt = Initializer
AutoDeclarationX , Identifier TemplateParametersopt = Initializer
--> This is for variable declarations with type inference, not for function
declaration.
So, the specification should have one more non-terminal symbol
AutoFuncDeclaration, as follows:
AutoFuncDeclaration:
StorageClasses Identifier FuncDeclaratorSuffix FunctionBody
FuncDeclaratorSuffix:
Parameters MemberFunctionAttributes_opt
TemplateParameters Parameters MemberFunctionAttributes_opt Constraint_opt
--
More information about the Digitalmars-d-bugs
mailing list