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


-- 
           Summary: unwanted limited range warning in template code
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrs at apple dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34783

Reply via email to