It seems silly for a project to get warnings in the below case. It seems silly to require that one specialize just to avoid the warning. $ cat t.cc void bar(); template <class T> void foo(T t) { if (t < 257) bar(); } void bee() { foo(1); foo(char(1)); } $ g++ t.cc -c t.cc: In function ‘void foo(T) [with T = char]’: t.cc:9: instantiated from here t.cc:4: warning: comparison is always true due to limited range of data type
You know bugzilla has a search for a reason? *** This bug has been marked as a duplicate of 11856 ***
No, that bug report has a hack around, not a fix. A fix would make it work by default out of the box. A fix would avoid these for templated types and leave them for non-templated types.
And that bug is not closed yet so what is the issue there? *** This bug has been marked as a duplicate of 11856 ***
Ah, I thought someone just hadn't gotten around to moving the state to fixed, sorry.