The warning (line 960) tries to catch non-sensical arithmetic typing and is generally a useful catcher of bugs. However in template contexts, tests in the code must deal with a variety of types, for some of which the test is determined (and so causes the warning) and for others of which it does useful FOC. In general, this warning should not be issued when the type in question is a tependent of a template argument, and should be issued in all other contexts. Ivan
Created attachment 6427 [details] Compiler output (-v -save-temps)
Created attachment 6428 [details] Source code (-save-temps)
p.s. I tried without success to reproduce this warning in a simple template case e.g.: #include <iostream> template<typename T> void Foo(T t) { if (t < 0) std::cout << "foo" << std::endl; } int main() { int i; unsigned int ui; Foo(i); Foo(ui); return 0; } This suggests that the compiler already omits this warning for templates, and I have hit a bug (rather than a missing feature) in which it is still warning in the case I happened to hit. Ivan
Confirmed with your example with -Wextra (aka -W). Note some warnings are from differnet places and are controlled differently. I forgot why this warns with -W and your complete example warns with -Wall. PS I think there is a bug like this some where also.
Yes this is a dup of bug 11856. *** This bug has been marked as a duplicate of 11856 ***