From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26600 invoked by alias); 10 Jun 2009 15:28:22 -0000 Received: (qmail 26590 invoked by uid 22791); 10 Jun 2009 15:28:22 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f205.google.com (HELO mail-ew0-f205.google.com) (209.85.219.205) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Jun 2009 15:28:13 +0000 Received: by ewy1 with SMTP id 1so1142062ewy.8 for ; Wed, 10 Jun 2009 08:28:11 -0700 (PDT) Received: by 10.210.18.8 with SMTP id 8mr4300976ebr.54.1244647690952; Wed, 10 Jun 2009 08:28:10 -0700 (PDT) Received: from yakj.usersys.redhat.com (wlanconf-nat-pool-brq.redhat.com [62.40.79.65]) by mx.google.com with ESMTPS id 28sm2699eyg.4.2009.06.10.08.28.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Jun 2009 08:28:10 -0700 (PDT) Message-ID: <4A2FD0FE.8090508@gmail.com> Date: Wed, 10 Jun 2009 15:28:00 -0000 From: Paolo Bonzini User-Agent: Thunderbird 2.0.0.17 (X11/20081009) MIME-Version: 1.0 To: Ian Lance Taylor CC: gcc@gcc.gnu.org Subject: Re: skip_evaluation References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00245.txt.bz2 > 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 (build_pointer_type (target_type), expr); > if (!want_pointer) > expr = build_indirect_ref (EXPR_LOCATION (expr), expr, NULL); > return expr; > } > > 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). Paolo