Community
Participate
Working Groups
// taken from cpp spec 3.3.6-5 example: typedef int c; enum { i = 1 }; class X { int i=3; char v[i]; int f() { return sizeof(c); } // OK: X::c // invalid ProblemBinding on c char c; enum { i = 2 }; }; typedef char* T; struct Y { typedef long T; T b; }; typedef int I; class D { typedef I I; // error, even though no reordering involved };
John: This is an ambiguity between sizeof unary-expression sizeof ( type-id ) In this case it is parsed as ( type-id ), and c is not a type, so we generate a problem. During the parse, you wouldn't be able to resolve this ambiguity until the end of the composite type spec, since the c that is found is actually after the sizeof. Can we do anything about the ambiguity or should I just relax the type checking in this case?
Fix applied to HEAD.