Reputation: 2591
In [dcl.ambig.res]/2 we find the following:
void foo(signed char a) {
sizeof(int(a)); // expression
sizeof(int(unsigned(a))); // type-id (ill-formed)
}
Why is int(a)
an expression and int(unsigned(a))
a type-id?
At first sight I would say that both are expressions.
Upvotes: 7
Views: 197
Reputation: 25377
int(unsigned(a))
is parsed the same as int(unsigned a)
, which is a function type
Upvotes: 8