From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9401 invoked by alias); 10 Jun 2009 15:46:10 -0000 Received: (qmail 9389 invoked by uid 22791); 10 Jun 2009 15:46:09 -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 smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Jun 2009 15:46:05 +0000 Received: from spaceape10.eur.corp.google.com (spaceape10.eur.corp.google.com [172.28.16.144]) by smtp-out.google.com with ESMTP id n5AFk211001894 for ; Wed, 10 Jun 2009 08:46:02 -0700 Received: from pxi17 (pxi17.prod.google.com [10.243.27.17]) by spaceape10.eur.corp.google.com with ESMTP id n5AFjFmD010369 for ; Wed, 10 Jun 2009 08:46:00 -0700 Received: by pxi17 with SMTP id 17so223615pxi.26 for ; Wed, 10 Jun 2009 08:46:00 -0700 (PDT) Received: by 10.114.112.2 with SMTP id k2mr2339041wac.101.1244648760062; Wed, 10 Jun 2009 08:46:00 -0700 (PDT) Received: from localhost.localdomain.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id l37sm9270489waf.40.2009.06.10.08.45.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Jun 2009 08:45:59 -0700 (PDT) To: Paolo Bonzini Cc: gcc@gcc.gnu.org Subject: Re: skip_evaluation References: <4A2FD0FE.8090508@gmail.com> From: Ian Lance Taylor Date: Wed, 10 Jun 2009 15:46:00 -0000 In-Reply-To: <4A2FD0FE.8090508@gmail.com> (Paolo Bonzini's message of "Wed\, 10 Jun 2009 17\:27\:58 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes 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/msg00248.txt.bz2 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 -- 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