summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/self-comparison.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-01-07 22:18:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-01-07 22:18:05 +0000
commit07c0f285ba92148f5793959c386dc2ba8f0cc7f7 (patch)
tree964b85fb29ee7613ed394bb8fe656d16945b4e23 /clang/test/SemaCXX/self-comparison.cpp
parente15bffe9ea8743182f70f18d1a8720c21d28be18 (diff)
downloadbcm5719-llvm-07c0f285ba92148f5793959c386dc2ba8f0cc7f7.tar.gz
bcm5719-llvm-07c0f285ba92148f5793959c386dc2ba8f0cc7f7.zip
Fix a couple of wrong self-comparison diagnostics.
Check whether we are comparing the same entity, not merely the same declaration, and don't assume that weak declarations resolve to distinct entities. llvm-svn: 321976
Diffstat (limited to 'clang/test/SemaCXX/self-comparison.cpp')
-rw-r--r--clang/test/SemaCXX/self-comparison.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/self-comparison.cpp b/clang/test/SemaCXX/self-comparison.cpp
index fb15ec84306..2af19abb30a 100644
--- a/clang/test/SemaCXX/self-comparison.cpp
+++ b/clang/test/SemaCXX/self-comparison.cpp
@@ -21,3 +21,7 @@ struct A {
return a == c; // expected-warning {{array comparison always evaluates to false}}
}
};
+
+namespace NA { extern "C" int x[3]; }
+namespace NB { extern "C" int x[3]; }
+bool k = NA::x == NB::x; // expected-warning {{self-comparison always evaluates to true}}
OpenPOWER on IntegriCloud