majenko:
you can't have a warning for something that is perfectly valid, just not correct.
That's the entire point of a warning rather than an error. this code is valid:
if (n = 8) {
}
In fact, that is even used:
int ret;
const char* s = "Hello there", t = "Hello There";
if (ret = strcmp(s, t)) {
// strings do not match
}
else {
// strings do match
}
so the compiler's warning says "put parentheses around it to show me you know it's weird."
Something that could be correct but probably isn't shouldn't get a warning unless there's a way of expressing the same thing without getting the warning. So it could be an error for if(statement); {/*...*/}
but it could be suppressed by if(statement) { } {/*...*/