The following code fails for GCC: struct A { int a; }; struct B : A {}; struct C : A {}; struct D : B, C { }; int main() { (void) sizeof(D::a); }
According to the current draft, such use is correct: Name lookup will resolve to a single declaration, and sizeof does not make additional constraint with regard to the subobject to refer to. It is reasonable to suspect a standard defect - this bug report is supposed to be a reminder in that case. -- Summary: Extended sizeof (referring to non-static member) rises ambiguity Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schaub-johannes at web dot de GCC host triplet: 4.4.1 GCC target triplet: 4.4.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41796