diff options
Diffstat (limited to 'clang/test/CXX/special')
-rw-r--r-- | clang/test/CXX/special/class.copy/p11.0x.copy.cpp | 13 | ||||
-rw-r--r-- | clang/test/CXX/special/class.copy/p11.0x.move.cpp | 2 | ||||
-rw-r--r-- | clang/test/CXX/special/class.ctor/p5-0x.cpp | 6 |
3 files changed, 17 insertions, 4 deletions
diff --git a/clang/test/CXX/special/class.copy/p11.0x.copy.cpp b/clang/test/CXX/special/class.copy/p11.0x.copy.cpp index 1ca0143d093..a4d0cdcdc73 100644 --- a/clang/test/CXX/special/class.copy/p11.0x.copy.cpp +++ b/clang/test/CXX/special/class.copy/p11.0x.copy.cpp @@ -121,13 +121,22 @@ 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 note on the class-name is attached to the location of the +// constructor. This is not especially clear. +struct RValueTmp { // expected-note {{used here}} + int && ri = 1; // expected-note{{copy constructor of 'RValueTmp' is implicitly deleted because field 'ri' is of rvalue reference type 'int &&'}} + // expected-error@-1 {{reference member 'ri' binds to a temporary}} +}; +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&); diff --git a/clang/test/CXX/special/class.copy/p11.0x.move.cpp b/clang/test/CXX/special/class.copy/p11.0x.move.cpp index ab4259548e7..5b016836e9e 100644 --- a/clang/test/CXX/special/class.copy/p11.0x.move.cpp +++ b/clang/test/CXX/special/class.copy/p11.0x.move.cpp @@ -145,7 +145,7 @@ HasNoAccessDtorBase HNADBb(HNADBa); // expected-error{{implicitly-deleted copy c // The restriction on rvalue reference members applies to only the copy // constructor. struct RValue { - int &&ri = 1; // expected-warning {{binding reference member 'ri' to a temporary}} expected-note {{here}} + int &&ri = 1; RValue(RValue&&); }; RValue::RValue(RValue&&) = default; diff --git a/clang/test/CXX/special/class.ctor/p5-0x.cpp b/clang/test/CXX/special/class.ctor/p5-0x.cpp index 2360345a484..5558313ce78 100644 --- a/clang/test/CXX/special/class.ctor/p5-0x.cpp +++ b/clang/test/CXX/special/class.ctor/p5-0x.cpp @@ -43,8 +43,12 @@ class NotDeleted2a { int &a = n; }; NotDeleted2a nd2a; class NotDeleted2b { int &a = error; }; // expected-error {{undeclared identifier}} NotDeleted2b nd2b; -class NotDeleted2c { int &&a = 0; }; // expected-warning {{binding reference member 'a' to a temporary}} expected-note {{here}} +class NotDeleted2c { int &&a = static_cast<int&&>(n); }; NotDeleted2c nd2c; +// Note: this one does not have a deleted default constructor even though the +// implicit default constructor is ill-formed! +class NotDeleted2d { int &&a = 0; }; // expected-error {{reference member 'a' binds to a temporary object}} expected-note {{here}} +NotDeleted2d nd2d; // expected-note {{first required here}} // - any non-variant non-static data member of const qualified type (or array // thereof) with no brace-or-equal-initializer does not have a user-provided |