[Bug c/12877] conditional as lvalue gives wrong warning

falk dot hueffner at student dot uni-tuebingen dot de gcc-bugzilla@gcc.gnu.org
Sun Nov 2 21:36:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12877



------- Additional Comments From falk dot hueffner at student dot uni-tuebingen dot de  2003-11-02 21:36 -------
Subject: Re:  conditional as lvalue gives wrong warning

"jsm at polyomino dot org dot uk" <gcc-bugzilla@gcc.gnu.org> writes:

> > But it's a conditional, not a cast, and I think this extension isn't
> > deprecated.
> 
> The cast is implicit; the semantics of conditional expressions mean that
> the chars are converted to a common type of int before the conditional
> expression is applied to them.

Well, as a technical term, casts are always explicit; what happens is
a conversion. So IMHO the message is still wrong.

> Essentially, the extension in question wasn't properly thought out
> for anything other than the case of a common type that is unaffected
> by the integer promotions.  The problem is arguably that we don't
> get a hard error here.

C++ has deal with it, so if we really wanted to, it should be possible
to come up with sensible semantics.

> This extension only isn't deprecated *yet* so that the deprecations
> (and any associated problems) could be dealt with one at a time.  PR
> 11427 has a specific suggestion that it be deprecated and no
> objections thereto.  I'm inclined on that basis to go ahead with
> deprecating conditional expressions as lvalues in C for 3.4, and
> then follow with compound expressions, also for 3.4.

I agree.



More information about the Gcc-bugs mailing list