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?


-- 
           Summary: Ternary operator warning on assignment used as truth
                    value
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ianw at vmware dot com


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

Reply via email to