On Wed, Jun 10, 2009 at 10:51 AM, Paolo Bonzini wrote:
>
>>> struct B {};
>>> struct D : public B {
>>> static const int i = sizeof((B*)(D*)0);
>>> };
>>>
>>> struct Z {};
>>> struct A : Z {};
>>> Z* implicitToZ (Z*);
>>> struct B : A {
>>> static const int i = sizeof(impl
struct B {};
struct D : public B {
static const int i = sizeof((B*)(D*)0);
};
struct Z {};
struct A : Z {};
Z* implicitToZ (Z*);
struct B : A {
static const int i = sizeof(implicitToZ((B*)0));
};
struct B {};
struct D;
D* p;
struct D: public B
Paolo Bonzini writes:
>> Presumably the early return is OK within a sizeof expression; it is OK
>> within an expression like (0 ? x : y)?
>
> From reading the code, I'd say yes. The bug that Jason fixed is
> related to stuff that cannot appear within a constant expression
> except within sizeof
In asking this, I'm particularly puzzled by code like this in
build_base_path in cp/class.c:
/* Don't bother with the calculations inside sizeof; they'll ICE if the
source type is incomplete and the pointer value doesn't matter. */
if (skip_evaluation)
{
expr = build_nop (bu