[Bug c++/27177] [4.0/4.1/4.2/4.3 Regression] ICE in build_simple_base_path, at cp/class.c:474

crowl at google dot com gcc-bugzilla@gcc.gnu.org
Wed May 2 01:24:00 GMT 2007

------- Comment #12 from crowl at google dot com  2007-05-02 02:24 -------
(In reply to comment #10)
> I am not convinced that the code in Comment #8 is valid.
> Although the operand of sizeof is not in fact evaluated, it seems odd to
> permit an operand which cannot, even in principle, be evaluated.  This is
> not even a case in which evaluating the operand would lead to undefined
> behavior; there is simply no way to evaluate the operand at all.  If there
> is an implicit conversion from B* to Z* at this point, then we must know
> how to perform the conversion, but we cannot, since B is not complete.

While that view has merit, I find no requirement in the standard that
requires a complete class.  Setting that aside s possibly unreasonable,
I think 4.10 paragraph 3 "The null pointer value is converted to the null
pointer value of the destination type." enables conversion of null pointers
when the pointer type has known bases but is not yet complete.

> Are you arguing that in:
>   struct B {};
>   struct D : public B {                                      
>     static const int i = sizeof((B*)(D*)0);                  
>   };
> the conversion from D* to B* is a static_cast?

I think (B*)(D*)0 is a conversion under 4.10.

> Has anyone asked about this case on the core reflector?

Would you like me to?



More information about the Gcc-bugs mailing list