<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-10-29 21:33 GMT+09:00 Bruno Medeiros via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Someone opened an issue report for a bug in the DDT parser, it doesn't parse this:<br>
<br>
template X(int Y){}<br>
<br>
@X!3  // error here<br>
void main(){}<br>
<br>
And yet DMD accepts this code. Is this grammar supposed to be valid though? The grammar spec doesn't allow it, not that means much. I searched for an open grammar bug, but couldn't find one.</blockquote><div><br></div><div>It is a grammar bug, because DMD parser intentionally accepts the syntax.</div><div><br></div><div><a href="https://github.com/D-Programming-Language/dmd/blob/9d1d0245fda3107f01d2b1460c7bcc34188a751e/src/parse.c#L1003">https://github.com/D-Programming-Language/dmd/blob/9d1d0245fda3107f01d2b1460c7bcc34188a751e/src/parse.c#L1003</a><br></div><div><br></div><div>StorageClass Parser::parseAttribute(Expressions **pudas)<br></div><div><div>{</div><div>    nextToken();</div><div>    Expressions *udas = NULL;</div><div>    StorageClass stc = 0;</div><div>    if (token.value == TOKidentifier)</div><div>    {</div><div>        if (token.ident == Id::property)</div><div>            ...</div><div>        else</div><div>        {</div><div>            // Allow identifier, template instantiation, or function call   <-----</div><div>            Expression *exp = parsePrimaryExp();</div><div>            if (token.value == TOKlparen)</div><div>            {</div><div>                Loc loc = token.loc;</div><div>                exp = new CallExp(loc, exp, parseArguments());</div><div>            }</div><div><br></div><div>            udas = new Expressions();</div><div>            udas->push(exp);</div><div>        }</div><div>    }</div></div><div><br></div><div>Kenji Hara</div></div></div></div>