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: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
$ 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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs