From 056abd2059c65a3e908193aeae16fad98017437c Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 2 Dec 2012 13:20:44 +0000 Subject: Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2): http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974 --- test/Analysis/operator-calls.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/Analysis/operator-calls.cpp') 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}} + } +} -- cgit v1.1