When compiling the following code with -Wparentheses, no warning is shown: cat <<EOF >missing-parentheses.cpp int main(int argc, char** argv) { int a = 1; int b = 2; if (a = b) a++; return 0; } EOF g++ -c -Wparentheses missing-parentheses.cpp
-- Summary: -Wparentheses does not warn on single equals sign inside if statement Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bart dot vanassche at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: powerpc-unknown-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29765