------- Comment #17 from crowl at google dot com 2008-01-14 21:29 ------- Subject: Re: [4.1/4.2/4.3 Regression] ICE in build_simple_base_path, at cp/class.c:474
The consensus of the C++ standards reflector is that all three following code snippets are well-formed. explicit: struct B {}; struct D : public B { static const int i = sizeof((B*)(D*)0); }; implicit: struct Z {}; struct A : Z {}; Z* implicitToZ (Z*); struct B : A { static const int i = sizeof(implicitToZ((B*)0)); }; non-null: struct B {}; struct D; D* p; struct D: public B { static const int i = sizeof ((B*)p); }; The rational is that even though the classes are not complete within their body, the bases must be known. The reason is that other features of the language, like co-variant returns, would fail. Since the bases are known, the conversions are well-formed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27177