This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12877] conditional as lvalue gives wrong warning
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Nov 2003 21:10:17 -0000
- Subject: [Bug c/12877] conditional as lvalue gives wrong warning
- References: <20031102182114.12877.falk@debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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 jsm at polyomino dot org dot uk 2003-11-02 21:10 -------
Subject: Re: New: conditional as lvalue gives wrong warning
On Sun, 2 Nov 2003, falk at debian dot org wrote:
> 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. 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. A similar case where
instead of a straight assignment the conditional expression was being used
as an output for an asm was rejected (PR 11564); the types there were
different but the problem applies just as much where they are the same but
get promoted.
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.