http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52957
Bug #: 52957
Summary: Missing suggestions on '=' and '==' confusion
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
void foo();
void bar();
void test(int i) {
// ...
if (i = 42) foo();
else bar();
}
/*
parentheses1.cpp:5:9: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
if (i = 42) foo();
~~^~~~
parentheses1.cpp:5:9: note: place parentheses around the assignment to
silence this warning
if (i = 42) foo();
^
( )
parentheses1.cpp:5:9: note: use '==' to turn this assignment into an
equality comparison
if (i = 42) foo();
^
==
1 warning generated.
*/