p8-cxx11.cpp revision 704c8f76bbe2de68375f7f146e75bd74de6dd518
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 11struct ConstCopy { 12 ConstCopy(const ConstCopy &); 13}; 14 15struct NonConstCopy { 16 NonConstCopy(NonConstCopy &); 17}; 18 19struct DeletedConstCopy { 20 DeletedConstCopy(const DeletedConstCopy &) = delete; 21}; 22 23struct DeletedNonConstCopy { 24 DeletedNonConstCopy(DeletedNonConstCopy &) = delete; 25}; 26 27struct ImplicitlyDeletedConstCopy { 28 ImplicitlyDeletedConstCopy(ImplicitlyDeletedConstCopy &&); 29}; 30 31 32struct A : ConstCopy {}; 33struct B : NonConstCopy { ConstCopy a; }; 34struct C : ConstCopy { NonConstCopy a; }; 35struct D : DeletedConstCopy {}; 36struct E : DeletedNonConstCopy {}; 37struct F { ImplicitlyDeletedConstCopy a; }; 38struct G : virtual B {}; 39 40struct 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 friend F::F(const F &); 47 friend G::G(G &); 48}; 49