Bug 9503 – [grammar] template declaration/instance must take one or more arguments?

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-12T19:59:00Z
Last change time
2013-02-12T21:26:18Z
Keywords
pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-02-12T19:59:33Z
I found a funny grammar bug. In current, nonterminal TemplateDeclaration symbol is defined as follows. http://dlang.org/template TemplateDeclaration: template TemplateIdentifier ( TemplateParameterList ) Constraintopt { DeclDefs } And, TemplateParameterList is defined as: TemplateParameterList: TemplateParameter TemplateParameter , TemplateParameter , TemplateParameterList TemplateParameterList must consume one or more TemplateParameter, so we cannot declare zero-arg template declaration! Of course it is possible with current compiler, so it's a grammar bug. Same problem is in TemplateMixinDeclaration. Also, template instantiation grammar has similar problem. TemplateArgumentList must consume one or more arguments, so TemplateMixin and TemplateInstance cannot take zero arguments.
Comment #1 by k.hara.pg — 2013-02-12T21:25:40Z
Comment #2 by github-bugzilla — 2013-02-12T21:26:18Z
Commits pushed to master at https://github.com/D-Programming-Language/d-programming-language.org https://github.com/D-Programming-Language/d-programming-language.org/commit/2c34db6317318825ae9387e3954f65c06f2ac102 fix Issue 9503 - [grammar] template declaration/instance must take one or more arguments? - Define TemplateParameters and TemplateArguments, and use them as like Parameters - Function template and template constructor also couldn't take zero template parameters. Moreover, DeclarationSuffix had been wrong, because TemplateParameterList does not have both side parenthesis. https://github.com/D-Programming-Language/d-programming-language.org/commit/8de780bf1457fd8c9eca9e683cd6bb25fa140418 Merge pull request #274 from 9rnsr/fix9503 Issue 9503 - [grammar] template declaration/instance must take one or more arguments?