[Issue 7184] parse error on *(x)++

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 2 10:01:49 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=7184

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
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.
Since none of the above is actually encountered, the parser presumes you tried
to do a C style cast. Note that dropping the useless parens or doing *((x))++
works since the parser then knows that the outermost () hold a primary
expression.

The behavior is according to the spec, so I will close this as invalid. 

[1] https://dlang.org/spec/grammar.html#UnaryExpression

--


More information about the Digitalmars-d-bugs mailing list