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.