http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55643
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Version|unknown |4.7.2 Summary|[4.7/4.8 Regression] g++ |[4.7/4.8 Regression] |incorrectly prints |[C++11] incorrect |"warning: variable ‘myVar’ |"warning: variable ‘myVar’ |set but not used |set but not used" with an |[-Wunused-but-set-variable] |"enum class"-typed variable |" when an "enum |is casted to double for the |class"-typed variable is |use |cast to double before use | --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-10 23:54:04 UTC --- Here is a small testcase without any includes: enum class MyEnum { eSomeValue = 123 }; void f(const char*, ...); int main() { MyEnum myVar = MyEnum::eSomeValue; // As far as Wunused-but-set-variable is concerned, any of the following // will successfully "use" myVar: // printf("%d\n", myVar); // printf("%d\n", (int)myVar); // printf("%u\n", (unsigned)myVar); // ...but these do not: f("%f\n", (double)myVar); f("%f\n", (float)myVar); return 0; }