brintos

brintos / llvm-project-archived public Read only

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