1 // RUN: %clang_cc1 -std=c++11 %s -verify 2 3 // C++98 [class.copy]p5 / C++11 [class.copy]p8. 4 5 // The implicitly-declared copy constructor for a class X will have the form 6 // X::X(const X&) 7 // if [every direct subobject] has a copy constructor whose first parameter is 8 // of type 'const volatile[opt] T &'. Otherwise, it will have the form 9 // X::X(X&) 10 11 struct ConstCopy { 12 ConstCopy(const ConstCopy &); 13 }; 14 15 struct NonConstCopy { 16 NonConstCopy(NonConstCopy &); 17 }; 18 19 struct DeletedConstCopy { 20 DeletedConstCopy(const DeletedConstCopy &) = delete; 21 }; 22 23 struct DeletedNonConstCopy { 24 DeletedNonConstCopy(DeletedNonConstCopy &) = delete; 25 }; 26 27 struct ImplicitlyDeletedConstCopy { 28 ImplicitlyDeletedConstCopy(ImplicitlyDeletedConstCopy &&); 29 }; 30 31 32 struct A : ConstCopy {}; 33 struct B : NonConstCopy { ConstCopy a; }; 34 struct C : ConstCopy { NonConstCopy a; }; 35 struct D : DeletedConstCopy {}; 36 struct E : DeletedNonConstCopy {}; 37 struct F { ImplicitlyDeletedConstCopy a; }; 38 struct G : virtual B {}; 39 40 struct Test { 41 friend A::A(const A &); 42 friend B::B(B &); 43 friend C::C(C &); 44 friend D::D(const D &); 45 friend E::E(E &); 46 constexpr friend F::F(const F &); 47 friend G::G(G &); 48 }; 49