http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47729
Samuel Marks <samuelmarks at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major --- Comment #2 from Samuel Marks <samuelmarks at gmail dot com> 2011-02-14 11:19:29 UTC --- (In reply to comment #1) > > Unfortunately I don't receive warning message when comparing signed and > > unsigned integers within a function. > > > > When comparing with >, >=, < or <=, it gives me a warning message. > > > > Only when comparing with != inside a function does the warning message not > > appear. > > This is rather confused. You don't get the warning on line 19 because the > function template is instantiated with n/size equal to the constant 4u, so > there is no real need to warn here. > > The relevant comment in the source code of the compiler is: > > /* Do not warn if the comparison is an equality operation, the > unsigned quantity is an integral constant, and it would fit > in the result if the result were signed. */ Good point, I was thinking the same; however thought that condition would also hold true for >, <, >=, <=...