[Issue 7184] parse error on *(x)++
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 6 14:10:17 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=7184
--- Comment #10 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to timon.gehr from comment #9)
> (In reply to timon.gehr from comment #8)
> > (In reply to RazvanN from comment #1)
> > > Issuing an error is the correct behavior. As you can see in the grammar [1],
> > > *(x)++ is parsed the following way: *UnaryExpression. If a parenthesis is
> > > encountered, then the parser expects a type :
> > > (type).identifier/templateInstance.
> >
> > That is the bug. The grammar allows the derivation
> >
> > UnaryExpression
> > \
> > PowExpression
> > \
> > PostfixExpression
> > \
> > PostfixExpression ++
> > \
> > ( PrimaryExpression )
> > \
> > ...
> > \
> > Identifier
> >
>
> Should have been:
>
> UnaryExpression
> \
> PowExpression
> \
> PostfixExpression
> \
> PostfixExpression ++
> \
> PrimaryExpression
> \
> ( Expression )
> \
> ...
> \
> Identifier
That is correct. I looked at the code which tests that the content of the
parentheses is a type and at the UnaryExpression expression grammar so I
presumed that you cannot have the given construct. I understand now that indeed
this is not acceptable behavior. Thanks
--
More information about the Digitalmars-d-bugs
mailing list