summaryrefslogtreecommitdiff
path: root/test/SemaCXX/self-comparison.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2019-09-21 04:18:54 +0000
committerRichard Trieu <rtrieu@google.com>2019-09-21 04:18:54 +0000
commit4d764c760bc19a720a89edadb05d5c13fc5908b6 (patch)
tree9918204e52f8f56c94cea3cb750a6c8c86fbc63d /test/SemaCXX/self-comparison.cpp
parentdbb59f794229857ec4acc86f12f3f9172ec253f6 (diff)
downloadclang-4d764c760bc19a720a89edadb05d5c13fc5908b6.tar.gz
Fix bad APInt compare.
APInt comparison require both to have the same bitwidth. Since only the value is needed, use the compare function APInt::isSameValue instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/self-comparison.cpp')
-rw-r--r--test/SemaCXX/self-comparison.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/SemaCXX/self-comparison.cpp b/test/SemaCXX/self-comparison.cpp
index 4ea16665f1..e20706a8b6 100644
--- a/test/SemaCXX/self-comparison.cpp
+++ b/test/SemaCXX/self-comparison.cpp
@@ -86,6 +86,7 @@ int struct_test(S s1, S s2, S *s3, T t) {
return s3->field == s3->field; // expected-warning {{self-comparison always evaluates to true}}
return s3->static_field == S::static_field; // expected-warning {{self-comparison always evaluates to true}}
return s1.array[0] == s1.array[0]; // expected-warning {{self-comparison always evaluates to true}}
+ return s1.array[0] == s1.array[0ull]; // expected-warning {{self-comparison always evaluates to true}}
return s1.array[I1] == s1.array[I1]; // expected-warning {{self-comparison always evaluates to true}}
return s1.array[s2.array[0]] == s1.array[s2.array[0]]; // expected-warning {{self-comparison always evaluates to true}}
return s3->array[t.field] == s3->array[t.field]; // expected-warning {{self-comparison always evaluates to true}}