C++: constant folding in a conditional expr
Nathan Sidwell
nathan@codesourcery.com
Thu Mar 29 19:20:00 GMT 2001
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
More information about the Gcc-patches
mailing list