This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++: constant folding in a conditional expr


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]