http://llvm.org/bugs/show_bug.cgi?id=10211
Summary: False positives with -Wconstant-logical-operand in
template code
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
-Wconstant-logical-operand warns about code where the constant argument was
instantiated from a template. This is idiomatically acceptable code. It comes
up a lot in e.g. Eigen:
http://eigen.tuxfamily.org/index.php?title=Main_Page
Anyone verifying this should probably do a test compile with some Eigen files,
e.g. 2.0.15's test/geometry.cpp [note: clang -I.. -D test_geometry], but here's
a short reduction of a few cases we should get:
template <class T> class A {
unsigned count() { return 0; }
bool test1() { return (count() && int(T::SomeBit)); }
enum {
SomeBit = T::SomeBit
};
bool test2() { return (count() && int(SomeBit)); }
};
struct B { enum { SomeBit = true }; };
template class A<B>;
The warning doesn't trigger here without the function-style casts.
--
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