summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/compare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/compare.cpp')
-rw-r--r--clang/test/SemaCXX/compare.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/compare.cpp b/clang/test/SemaCXX/compare.cpp
index 02b029a7762..8214f7899ec 100644
--- a/clang/test/SemaCXX/compare.cpp
+++ b/clang/test/SemaCXX/compare.cpp
@@ -405,4 +405,20 @@ namespace templates {
void test12() {
compare<0>(42);
}
+
+ struct A { static int x; };
+ struct B { static int x; };
+ typedef A otherA;
+
+ template <typename T>
+ void testx() {
+ if (A::x == T::x && // no warning
+ A::x == otherA::x) // expected-warning{{self-comparison always evaluates to true}}
+ return;
+ }
+
+ void test13() {
+ testx<A>();
+ testx<B>();
+ }
}
OpenPOWER on IntegriCloud