Closed frederick-vs-ja closed 1 year ago
sizeof
has the same issue. Whatever sizeof
does, typeof
will do as well, and I'm certain I don't have to write that out in the proposal since it should already be covered from other wording about how to resolve such ambiguities.
Oh I see, there's already [dcl.ambig.res]/2. It might be better to add some new examples there.
The token sequence
int()
in C++ can be either an expression or a type-id, for whichtypeof
will giveint
orint()
respectively.Perhaps we should specify that when an operand of
typeof
ortypeof_unqual
can be both parsed as an expression and a type-id, it is treated as a type-id (for C compatibility).