diff options
Diffstat (limited to 'test/CXX/special/class.copy/p11.0x.copy.cpp')
-rw-r--r-- | test/CXX/special/class.copy/p11.0x.copy.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/CXX/special/class.copy/p11.0x.copy.cpp b/test/CXX/special/class.copy/p11.0x.copy.cpp index 1ca0143d0930f..e7256bcf9485f 100644 --- a/test/CXX/special/class.copy/p11.0x.copy.cpp +++ b/test/CXX/special/class.copy/p11.0x.copy.cpp @@ -121,13 +121,21 @@ extern HasNoAccessDtorBase HNADBa; HasNoAccessDtorBase HNADBb(HNADBa); // expected-error{{implicitly-deleted copy constructor}} // -- a non-static data member of rvalue reference type +int some_int; struct RValue { - int && ri = 1; // expected-note{{copy constructor of 'RValue' is implicitly deleted because field 'ri' is of rvalue reference type 'int &&'}} - // expected-warning@-1{{binding reference member 'ri' to a temporary}} expected-note@-1 {{here}} + int && ri = static_cast<int&&>(some_int); // expected-note{{copy constructor of 'RValue' is implicitly deleted because field 'ri' is of rvalue reference type 'int &&'}} }; RValue RVa; RValue RVb(RVa); // expected-error{{call to implicitly-deleted copy constructor}} +// FIXME: The error on the class-name is attached to the location of the +// constructor. This is not especially clear. +struct RValueTmp { // expected-error {{reference member 'ri' binds to a temporary}} + int && ri = 1; // expected-note{{copy constructor of 'RValueTmp' is implicitly deleted because field 'ri' is of rvalue reference type 'int &&'}} // expected-note {{default member init}} +}; +RValueTmp RVTa; // expected-note {{implicit default constructor for 'RValueTmp' first required here}} +RValueTmp RVTb(RVTa); // expected-error{{call to implicitly-deleted copy constructor}} + namespace PR13381 { struct S { S(const S&); |