summaryrefslogtreecommitdiffstats
path: root/test/CXX
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-05-12 00:28:35 +0000
committerBill Wendling <isanbard@gmail.com>2012-05-12 00:28:35 +0000
commite2f692bd189cfdf562175b786fe92c87ecdfcbfb (patch)
tree7e87711c6f0f484373ffa378964b34d7e0c8eb52 /test/CXX
parent0b3707c66993e57868b5480e79a9e0707c987dc0 (diff)
Merging r155218:
------------------------------------------------------------------------ r155218 | rsmith | 2012-04-20 11:46:14 -0700 (Fri, 20 Apr 2012) | 5 lines Fix bug where a class's (deleted) copy constructor would be implicitly given a non-const reference parameter type if the class had any subobjects with deleted copy constructors. This causes a rejects-valid if the class's copy constructor is explicitly defaulted (as happens for some implementations of std::pair etc). ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_31@156682 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp8
-rw-r--r--test/CXX/special/class.copy/p8-cxx11.cpp48
2 files changed, 52 insertions, 4 deletions
diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
index b1b298e893..3e9accfbf6 100644
--- a/test/CXX/special/class.copy/implicit-move.cpp
+++ b/test/CXX/special/class.copy/implicit-move.cpp
@@ -198,15 +198,15 @@ namespace DR1402 {
struct NoMove4 : NonTrivialCopyAssign {}; // expected-note 2{{'const DR1402::NoMove4 &'}}
struct NoMove5 : virtual NonTrivialCopyCtor {}; // expected-note 2{{'const DR1402::NoMove5 &'}}
struct NoMove6 : virtual NonTrivialCopyAssign {}; // expected-note 2{{'const DR1402::NoMove6 &'}}
- struct NoMove7 : NonTrivialCopyCtorVBase {}; // expected-note 2{{'DR1402::NoMove7 &'}}
- struct NoMove8 : NonTrivialCopyAssignVBase {}; // expected-note 2{{'DR1402::NoMove8 &'}}
+ struct NoMove7 : NonTrivialCopyCtorVBase {}; // expected-note 2{{'const DR1402::NoMove7 &'}}
+ struct NoMove8 : NonTrivialCopyAssignVBase {}; // expected-note 2{{'const DR1402::NoMove8 &'}}
// A non-trivially-move-assignable virtual base class inhibits the declaration
// of a move assignment (which might move-assign the base class multiple
// times).
struct NoMove9 : NonTrivialMoveAssign {};
- struct NoMove10 : virtual NonTrivialMoveAssign {}; // expected-note {{'DR1402::NoMove10 &'}}
- struct NoMove11 : NonTrivialMoveAssignVBase {}; // expected-note {{'DR1402::NoMove11 &'}}
+ struct NoMove10 : virtual NonTrivialMoveAssign {}; // expected-note {{'const DR1402::NoMove10 &'}}
+ struct NoMove11 : NonTrivialMoveAssignVBase {}; // expected-note {{'const DR1402::NoMove11 &'}}
struct Test {
friend NoMove1::NoMove1(NoMove1 &&); // expected-error {{no matching function}}
diff --git a/test/CXX/special/class.copy/p8-cxx11.cpp b/test/CXX/special/class.copy/p8-cxx11.cpp
new file mode 100644
index 0000000000..02e6cd1c9a
--- /dev/null
+++ b/test/CXX/special/class.copy/p8-cxx11.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -std=c++11 %s -verify
+
+// C++98 [class.copy]p5 / C++11 [class.copy]p8.
+
+// The implicitly-declared copy constructor for a class X will have the form
+// X::X(const X&)
+// if [every direct subobject] has a copy constructor whose first parameter is
+// of type 'const volatile[opt] T &'. Otherwise, it will have the form
+// X::X(X&)
+
+struct ConstCopy {
+ ConstCopy(const ConstCopy &);
+};
+
+struct NonConstCopy {
+ NonConstCopy(NonConstCopy &);
+};
+
+struct DeletedConstCopy {
+ DeletedConstCopy(const DeletedConstCopy &) = delete;
+};
+
+struct DeletedNonConstCopy {
+ DeletedNonConstCopy(DeletedNonConstCopy &) = delete;
+};
+
+struct ImplicitlyDeletedConstCopy {
+ ImplicitlyDeletedConstCopy(ImplicitlyDeletedConstCopy &&);
+};
+
+
+struct A : ConstCopy {};
+struct B : NonConstCopy { ConstCopy a; };
+struct C : ConstCopy { NonConstCopy a; };
+struct D : DeletedConstCopy {};
+struct E : DeletedNonConstCopy {};
+struct F { ImplicitlyDeletedConstCopy a; };
+struct G : virtual B {};
+
+struct Test {
+ friend A::A(const A &);
+ friend B::B(B &);
+ friend C::C(C &);
+ friend D::D(const D &);
+ friend E::E(E &);
+ friend F::F(const F &);
+ friend G::G(G &);
+};