Bug 36050 - Ternary operator warning on assignment used as truth value
Summary: Ternary operator warning on assignment used as truth value
Status: RESOLVED DUPLICATE of bug 25733
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.3.1
: P3 trivial
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-25 22:16 UTC by Ian Wienand
Modified: 2008-04-27 22:13 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Wienand 2008-04-25 22:16:57 UTC
Hi,

It would be great if ? warned when it got a (presumably accidental) assignment like if statements do; e.g.

$ cat test.c
int main (void)
{
	int i;
	return (i = 20) ? 10 : 15;	
}
$ gcc-4.3 -Wall test.c 

It seems like this would be quite a common mistake?
Comment 1 Manuel López-Ibáñez 2008-04-27 22:13:39 UTC

*** This bug has been marked as a duplicate of 25733 ***