diff options
Diffstat (limited to 'test/CXX/special/class.copy/p11.0x.move.cpp')
-rw-r--r-- | test/CXX/special/class.copy/p11.0x.move.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/CXX/special/class.copy/p11.0x.move.cpp b/test/CXX/special/class.copy/p11.0x.move.cpp index ff9478b..1dce27a 100644 --- a/test/CXX/special/class.copy/p11.0x.move.cpp +++ b/test/CXX/special/class.copy/p11.0x.move.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +struct Trivial {}; struct NonTrivial { NonTrivial(NonTrivial&&); }; @@ -61,6 +62,24 @@ struct Deleted { }; Deleted::Deleted(Deleted&&) = default; // expected-error{{would delete}} +// It's implied (but not stated) that this should also happen if overload +// resolution fails. +struct ConstMember { + const Trivial ct; + ConstMember(ConstMember&&); +}; +ConstMember::ConstMember(ConstMember&&) = default; // ok, calls copy ctor +struct ConstMoveOnlyMember { + const NonTrivial cnt; + ConstMoveOnlyMember(ConstMoveOnlyMember&&); +}; +ConstMoveOnlyMember::ConstMoveOnlyMember(ConstMoveOnlyMember&&) = default; // expected-error{{would delete}} +struct VolatileMember { + volatile Trivial vt; + VolatileMember(VolatileMember&&); +}; +VolatileMember::VolatileMember(VolatileMember&&) = default; // expected-error{{would delete}} + // -- a direct or virtual base class B that cannot be moved because overload // resolution results in an ambiguity or a function that is deleted or // inaccessible @@ -108,7 +127,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; + int &&ri = 1; // expected-warning {{binding reference member 'ri' to a temporary}} expected-note {{here}} RValue(RValue&&); }; RValue::RValue(RValue&&) = default; |