https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66322
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Of course, I don't think switch ((int)boolean) { switch 1: is better or nice, and I wouldn't want to encourage writing such a code, the cast (you don't really have to change true to 1) is only meant as a way to quash the warning. But switch (boolean) seemed to be too obscure that giving a warning there didn't feel too far-fetched; especially if you can use the cast (in C, integer promotions are performed on the controlling expression anyway) if you really want that. To fix this, I think I'll have to defer the warning until c_finish_case and add some flag to c_switch struct and track whether the controlling expression had boolean type there. Then in c_do_switch_warnings decide if we want to warn or not.