annotate clang/test/CXX/special/class.copy/p8-cxx11.cpp @ 236:c4bab56944e8 llvm-original

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