www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9503] New: [grammar] template declaration/instance must take one or more arguments?

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9503

           Summary: [grammar] template declaration/instance must take one
                    or more arguments?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9503


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/d-programming-language.org/pull/274

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9503


Alex Rønne Petersen <alex lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alex lycus.org
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9503




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


Issue 9503 - [grammar] template declaration/instance must take one or more
arguments?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 12 2013