From 741c13ecc20fb35b836ad690aeecd402f002d654 Mon Sep 17 00:00:00 2001 From: rdivacky Date: Wed, 18 Nov 2009 14:59:57 +0000 Subject: Update clang to r89205. --- test/SemaCXX/conversion-function.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'test/SemaCXX/conversion-function.cpp') diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp index 6182678..c0c318e 100644 --- a/test/SemaCXX/conversion-function.cpp +++ b/test/SemaCXX/conversion-function.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify %s class X { public: operator bool(); @@ -93,3 +93,31 @@ void f(Yb& a) { char ch = a; // OK. calls Yb::operator char(); } +// Test conversion + copy construction. +class AutoPtrRef { }; + +class AutoPtr { + // FIXME: Using 'unavailable' since we do not have access control yet. + // FIXME: The error message isn't so good. + AutoPtr(AutoPtr &) __attribute__((unavailable)); + +public: + AutoPtr(); + AutoPtr(AutoPtrRef); + + operator AutoPtrRef(); +}; + +AutoPtr make_auto_ptr(); + +AutoPtr test_auto_ptr(bool Cond) { + AutoPtr p1( make_auto_ptr() ); + + AutoPtr p; + if (Cond) + return p; // expected-error{{incompatible type returning}} + + return AutoPtr(); +} + + -- cgit v1.1