summaryrefslogtreecommitdiff
path: root/test/Analysis/operator-calls.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Analysis/operator-calls.cpp
parent657bc3d9848e3be92029b2416031340988cd0111 (diff)
Notes
Diffstat (limited to 'test/Analysis/operator-calls.cpp')
-rw-r--r--test/Analysis/operator-calls.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/Analysis/operator-calls.cpp b/test/Analysis/operator-calls.cpp
index dbc63bc4bed8..066f6a3bc67a 100644
--- a/test/Analysis/operator-calls.cpp
+++ b/test/Analysis/operator-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,debug.ExprInspection -analyzer-ipa=inlining -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-ipa=inlining -verify %s
void clang_analyzer_eval(bool);
struct X0 { };
@@ -30,3 +30,22 @@ struct IntComparable {
void testMemberOperator(IntComparable B) {
clang_analyzer_eval(B == 0); // expected-warning{{TRUE}}
}
+
+
+
+namespace UserDefinedConversions {
+ class Convertible {
+ public:
+ operator int() const {
+ return 42;
+ }
+ operator bool() const {
+ return true;
+ }
+ };
+
+ void test(const Convertible &obj) {
+ clang_analyzer_eval((int)obj == 42); // expected-warning{{TRUE}}
+ clang_analyzer_eval(obj); // expected-warning{{TRUE}}
+ }
+}