1 | // RUN: %clang_cc1 -std=c++11 %s -verify |
2 | // expected-no-diagnostics |
3 | |
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 form |
7 | // X::X(const X&) |
8 | // if [every direct subobject] has a copy constructor whose first parameter is |
9 | // of type 'const volatile[opt] T &'. Otherwise, it will have the form |
10 | // X::X(X&) |
11 | |
12 | struct ConstCopy { |
13 | ConstCopy(const ConstCopy &); |
14 | }; |
15 | |
16 | struct NonConstCopy { |
17 | NonConstCopy(NonConstCopy &); |
18 | }; |
19 | |
20 | struct DeletedConstCopy { |
21 | DeletedConstCopy(const DeletedConstCopy &) = delete; |
22 | }; |
23 | |
24 | struct DeletedNonConstCopy { |
25 | DeletedNonConstCopy(DeletedNonConstCopy &) = delete; |
26 | }; |
27 | |
28 | struct ImplicitlyDeletedConstCopy { |
29 | ImplicitlyDeletedConstCopy(ImplicitlyDeletedConstCopy &&); |
30 | }; |
31 | |
32 | |
33 | struct A : ConstCopy {}; |
34 | struct B : NonConstCopy { ConstCopy a; }; |
35 | struct C : ConstCopy { NonConstCopy a; }; |
36 | struct D : DeletedConstCopy {}; |
37 | struct E : DeletedNonConstCopy {}; |
38 | struct F { ImplicitlyDeletedConstCopy a; }; |
39 | struct G : virtual B {}; |
40 | |
41 | struct 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 | |