diff options
Diffstat (limited to 'test/SemaCXX/conversion-function.cpp')
-rw-r--r-- | test/SemaCXX/conversion-function.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp index 972409ca5a..dfc0650641 100644 --- a/test/SemaCXX/conversion-function.cpp +++ b/test/SemaCXX/conversion-function.cpp @@ -129,7 +129,7 @@ private: }; A1 f() { - return "Hello"; // expected-error{{invokes deleted copy constructor}} + return "Hello"; // expected-error{{invokes deleted constructor}} } namespace source_locations { @@ -176,3 +176,29 @@ namespace crazy_declarators { *operator int(); // expected-error {{must use a typedef to declare a conversion to 'int *'}} }; } + +namespace smart_ptr { + class Y { + class YRef { }; + + Y(Y&); + + public: + Y(); + Y(YRef); + + operator YRef(); // expected-note{{candidate function}} + }; + + struct X { // expected-note{{candidate constructor (the implicit copy constructor) not}} + explicit X(Y); + }; + + Y make_Y(); + + X f() { + X x = make_Y(); // expected-error{{no viable conversion from 'smart_ptr::Y' to 'smart_ptr::X'}} + X x2(make_Y()); + return X(Y()); + } +} |