[LLVMbugs] [Bug 8682] New: clang should not issue -Wtautological-compare warnings on dependent values

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 24 10:47:17 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8682

           Summary: clang should not issue -Wtautological-compare warnings
                    on dependent values
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


$ cat taut.cpp 
template<unsigned n> bool compare(unsigned k) { return k >= n; }
int main() { return compare<0>(42); }
$ clang++ taut.cpp 
taut.cpp:1:58: warning: comparison of unsigned expression >= 0 is always true
[-Wtautological-compare]
template<unsigned n> bool compare(unsigned k) { return k >= n; }
                                                       ~ ^  ~
taut.cpp:2:21: note: in instantiation of function template specialization
'compare<0>' requested here
int main() { return compare<0>(42); }
                    ^
1 warning generated.


-Wtautological-compare should not be issued if the constant expression is
dependent on a template parameter. Equivalently, it should not be issued while
instantiating a template -- any correct warnings will have been generated while
parsing the template.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list