diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-18 14:59:57 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-18 14:59:57 +0000 |
| commit | b3d5a323a5ca92ea73443499cee2f15db1ff0fb3 (patch) | |
| tree | 60a1694bec5a44d15456acc880cb2f91619f66aa /test/SemaCXX/conversion-function.cpp | |
| parent | 8f57cb0305232cb53fff00ef151ca716766f3437 (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/conversion-function.cpp')
| -rw-r--r-- | test/SemaCXX/conversion-function.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp index 6182678e3113..c0c318ed3368 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(); +} + + |
