https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85963
Michael Cortez <mcortez at airpost dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #2 from Michael Cortez <mcortez at airpost dot net> --- Simplified test case: template<typename T> inline void foo(T& x) { const bool bar = true; x = bar ? (x*x) : T(0); } int main() { double x = 123.4; foo(x); return 0; } g++ bug.cpp -Wall -O2 bug.cpp: In instantiation of ‘void foo(T&) [with T = double]’: bug.cpp:9:8: required from here bug.cpp:3:14: warning: variable ‘bar’ set but not used [-Wunused-but-set-variable] const bool bar = true; ^~~