From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13278 invoked by alias); 25 Apr 2008 22:17:52 -0000 Received: (qmail 12183 invoked by uid 48); 25 Apr 2008 22:16:59 -0000 Date: Fri, 25 Apr 2008 22:17:00 -0000 Subject: [Bug c/36050] New: Ternary operator warning on assignment used as truth value X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ianw at vmware dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg01847.txt.bz2 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