diff options
Diffstat (limited to 'test/Analysis/operator-calls.cpp')
-rw-r--r-- | test/Analysis/operator-calls.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/Analysis/operator-calls.cpp b/test/Analysis/operator-calls.cpp index dbc63bc..066f6a3 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}} + } +} |