This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++: constant folding in a conditional expr
- To: Andrew Haley <aph at cambridge dot redhat dot com>
- Subject: Re: C++: constant folding in a conditional expr
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Thu, 29 Mar 2001 11:54:23 +0100
- CC: gcc-patches at gcc dot gnu dot org
- Organization: Codesourcery LLC
- References: <15042.14345.711999.46995@cuddles.cambridge.redhat.com>
Andrew Haley wrote:
> This test case fails if BROKEN is #defined:
This test case is illformed, regardless of BROKEN's #definedness :-)
[9.4.2]/4 requires an out of class definition of static data members
yea, even if the in-class declaration is of a constant type and
contains an initializer.
> I've written a patch that doesn't treat the conditional expr as an
> lvalue if either arm is read only, and that seems to fix the problem,
> but is it the right fix?
I don't think so. What if I wrote
ptr = &(data ? ACONST : BCONST);
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org