https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25689
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2006-01-06 12:32:23 |2014-10-12 --- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- A simpler testcase: struct Var { operator int() const; Var& operator = (int); }; void foo(Var var) { if (var = 0) {} // we should warn if (var.operator=(0)) {} // we should NOT warn } Clang prints: pr25689.C:8:11: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] if (var = 0) {} // if (var.operator=(0)) ~~~~^~~ pr25689.C:8:11: note: place parentheses around the assignment to silence this warning if (var = 0) {} // if (var.operator=(0)) ^ ( ) pr25689.C:8:11: note: use '==' to turn this assignment into an equality comparison if (var = 0) {} // if (var.operator=(0)) ^ ==