diff options
author | Hans Wennborg <hans@hanshq.net> | 2016-08-16 16:19:18 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2016-08-16 16:19:18 +0000 |
commit | 9ea2f5ae4c96e17dd5507a8c5fb90e1c6b2b240f (patch) | |
tree | 03ef2dd57d9dd4387e49d4cf631ce9cc6d96c78e /test | |
parent | f95bed858efd9fa2a63c15a8edf21e84a2560a4d (diff) |
Merging r278763:
------------------------------------------------------------------------
r278763 | rsmith | 2016-08-15 17:13:47 -0700 (Mon, 15 Aug 2016) | 5 lines
PR28978: If we need overload resolution for the move constructor of an
anonymous union member of a class, we need overload resolution for the move
constructor of the class itself too; we can't rely on Sema to do the right
thing for us for anonymous union types.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_39@278817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/special/class.copy/p11.0x.move.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CXX/special/class.copy/p11.0x.move.cpp b/test/CXX/special/class.copy/p11.0x.move.cpp index 514817d2b7..ab4259548e 100644 --- a/test/CXX/special/class.copy/p11.0x.move.cpp +++ b/test/CXX/special/class.copy/p11.0x.move.cpp @@ -4,6 +4,9 @@ struct Trivial {}; struct NonTrivial { NonTrivial(NonTrivial&&); // expected-note{{copy constructor is implicitly deleted}} }; +struct DeletedCopy { + DeletedCopy(const DeletedCopy&) = delete; +}; // A defaulted move constructor for a class X is defined as deleted if X has: @@ -22,6 +25,15 @@ struct DeletedNTVariant2 { }; DeletedNTVariant2::DeletedNTVariant2(DeletedNTVariant2&&) = default; // expected-error{{would delete}} +// Note, move constructor is not a candidate because it is deleted. +template<typename T> struct DeletedNTVariant3 { // expected-note 2{{default}} expected-note 2{{copy}} + union { + T NT; + }; +}; +extern DeletedNTVariant3<NonTrivial> dntv3a(0); // expected-error {{no matching}} +extern DeletedNTVariant3<DeletedCopy> dntv3a(0); // expected-error {{no matching}} + // -- a non-static data member of class type M (or array thereof) that cannot be // copied because overload resolution results in an ambiguity or a function // that is deleted or inaccessible |