[Issue 14719] Template instantiation parsed as C-style type cast
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jun 22 17:19:39 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14719
--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Yuxuan Shui from comment #2)
> First, (a!A) is not always a type, it can be a function or anything.
Yes, it's not yet determined in parsing stage. The determination will be done
in later semantic analysis stage.
> Second, B is a type, so parse !B as expression is weird.
Similarly to a!A, B is an identifier expression and it's not yet determined as
a type in parsing. A syntactically valid D code may be rejected by semantic
analysis, so it's not a problem.
Note that, D does not use exclamation mark `!` as binary operator, so !B is
always parsed as an unary expression (logical negation). Then prefixing
parenthesis (a!A) is parsed as C-style cast. There's no grammar ambiguity.
--
More information about the Digitalmars-d-bugs
mailing list