This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: skip_evaluation
- From: Ian Lance Taylor <iant at google dot com>
- To: Paolo Bonzini <paolo dot bonzini at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 10 Jun 2009 08:45:58 -0700
- Subject: Re: skip_evaluation
- References: <m37hzkrjjd.fsf@google.com> <4A2FD0FE.8090508@gmail.com>
Paolo Bonzini <paolo.bonzini@gmail.com> 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 -- for example
>
> 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 {
> static const int i = sizeof ((B*)p);
> };
>
> (see PR27177). All of these would still be forbidden within (0?x:y).
OK, but should they perhaps give an error which would perhaps not be
given if skip_evaluation is true?
Ian