summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/conversion-function.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-11-18 14:59:57 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-11-18 14:59:57 +0000
commit741c13ecc20fb35b836ad690aeecd402f002d654 (patch)
tree60a1694bec5a44d15456acc880cb2f91619f66aa /test/SemaCXX/conversion-function.cpp
parentb3a51061b1b9c4add078237850649f7c9efb13ab (diff)
downloadFreeBSD-src-741c13ecc20fb35b836ad690aeecd402f002d654.zip
FreeBSD-src-741c13ecc20fb35b836ad690aeecd402f002d654.tar.gz
Update clang to r89205.
Diffstat (limited to 'test/SemaCXX/conversion-function.cpp')
-rw-r--r--test/SemaCXX/conversion-function.cpp30
1 files changed, 29 insertions, 1 deletions
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();
+}
+
+
OpenPOWER on IntegriCloud