Closed petr-bauch closed 2 years ago
No (partially).
The parser tries to resolve such ambiguities based on a number of (context dependent) rules.
Identifying what A
is in the above depends on the rules.
However, we found the following in the C++20 specification.
If a condition can be syntactically resolved as either an expression or a declaration, it is interpreted as the latter.
We are thinking about adding some rules.
Sorry for the delay, just checked and it works perfectly.
This is probably more of a feature-request:
Will translate the condition as assignment where lhs is a multiplicative-expression.
Will translate as macro
A
applied toa
.I understand it's ambiguous without knowing what is a type but a similar code outside of an if-statement works as expected, e.g.
Is it because the parser by default expects the condition to be an expression?