http://llvm-reviews.chandlerc.com/D128
Files:
test/SemaCXX/compare.cpp
lib/Sema/SemaChecking.cpp
Index: test/SemaCXX/compare.cpp
===================================================================
--- test/SemaCXX/compare.cpp
+++ test/SemaCXX/compare.cpp
@@ -348,3 +348,16 @@
(void)((E)x == 1);
(void)((E)x == -1);
}
+
+template <typename T>
+void template9 (T t, unsigned u) {
+ (void)(t >= 0);
+ (void)(u >= 0); // expected-warning{{true}}
+
+ (void)(t != 0x100000000);
+ (void)(u != 0x100000000); // expected-warning{{true}}
+}
+
+void test9() {
+ template9<unsigned>(1,1);
+}
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -4309,6 +4309,9 @@
if (E->isValueDependent())
return;
+ if (!S.ActiveTemplateInstantiations.empty())
+ return;
+
if (op == BO_LT && IsZero(S, E->getRHS())) {
S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison)
<< "< 0" << "false" << HasEnumType(E->getLHS())
@@ -4336,6 +4339,9 @@
if (Value == 0)
return;
+ if (!S.ActiveTemplateInstantiations.empty())
+ return;
+
BinaryOperatorKind op = E->getOpcode();
QualType OtherT = Other->getType();
QualType ConstantT = Constant->getType();
Index: test/SemaCXX/compare.cpp
===================================================================
--- test/SemaCXX/compare.cpp
+++ test/SemaCXX/compare.cpp
@@ -348,3 +348,16 @@
(void)((E)x == 1);
(void)((E)x == -1);
}
+
+template <typename T>
+void template9 (T t, unsigned u) {
+ (void)(t >= 0);
+ (void)(u >= 0); // expected-warning{{true}}
+
+ (void)(t != 0x100000000);
+ (void)(u != 0x100000000); // expected-warning{{true}}
+}
+
+void test9() {
+ template9<unsigned>(1,1);
+}
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -4309,6 +4309,9 @@
if (E->isValueDependent())
return;
+ if (!S.ActiveTemplateInstantiations.empty())
+ return;
+
if (op == BO_LT && IsZero(S, E->getRHS())) {
S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison)
<< "< 0" << "false" << HasEnumType(E->getLHS())
@@ -4336,6 +4339,9 @@
if (Value == 0)
return;
+ if (!S.ActiveTemplateInstantiations.empty())
+ return;
+
BinaryOperatorKind op = E->getOpcode();
QualType OtherT = Other->getType();
QualType ConstantT = Constant->getType();
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits