Bug 13523 – Auto function declaration does not match any grammar rule

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-23T13:26:00Z
Last change time
2014-09-24T12:03:49Z
Keywords
pull, spec
Assigned to
nobody
Creator
k.hara.pg
Blocks
10233

Comments

Comment #0 by k.hara.pg — 2014-09-23T13:26:38Z
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
Comment #1 by k.hara.pg — 2014-09-23T13:46:31Z
Comment #2 by github-bugzilla — 2014-09-24T12:03:48Z
Commit pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/ea414cc69a59ed25a01778562d789a5cff66dad8 fix Issue 13523 - Auto function declaration does not match any grammar rule