Debian Codegraph @

tests/rule-of-three/main.h

raw
1 #include <QtCore/QObject>
2
3
4
5 struct HasDtor // Warning
6 {
7 ~HasDtor() { int a; }
8 };
9
10 struct HasDtorAndCopyCtor // Warning
11 {
12 HasDtorAndCopyCtor(const HasDtorAndCopyCtor &) {}
13 ~HasDtorAndCopyCtor() {}
14 };
15
16 struct HasDtorAndCopyCtorAndAssign // OK
17 {
18 HasDtorAndCopyCtorAndAssign(const HasDtorAndCopyCtorAndAssign &) {}
19 ~HasDtorAndCopyCtorAndAssign() {}
20 HasDtorAndCopyCtorAndAssign& operator=(const HasDtorAndCopyCtorAndAssign &) { return *this; }
21 };
22
23 struct HasNothing // OK
24 {
25 };
26
27 struct HasCopyCtor // Warning
28 {
29 HasCopyCtor() {}
30 HasCopyCtor(const HasCopyCtor &) {}
31 };
32
33 struct HasDefaults // OK
34 {
35 HasDefaults(const HasDefaults &) = default;
36 ~HasDefaults() = default;
37 HasDefaults& operator=(const HasDefaults &) = default;
38 };
39
40 struct HasOnlyDTOROnPurpose // OK
41 {
42 ~HasOnlyDTOROnPurpose();
43 private:
44 HasOnlyDTOROnPurpose(const HasOnlyDTOROnPurpose &) = delete;
45 HasOnlyDTOROnPurpose& operator=(const HasOnlyDTOROnPurpose &) = delete;
46 };
47
48 struct HasOnlyDTOROnPurpose2; // OK
49
50 struct HasOnlyDTOROnPurpose2 // OK
51 {
52 ~HasOnlyDTOROnPurpose2();
53 private:
54 Q_DISABLE_COPY(HasOnlyDTOROnPurpose2)
55 };
56
57 struct HasNothingButNested // OK
58 {
59 HasNothingButNested() {}
60 HasCopyCtor c;
61 };
62
63 struct Has3ButDtorDefault
64 {
65 ~Has3ButDtorDefault() = default;
66 Has3ButDtorDefault(const Has3ButDtorDefault &);
67 Has3ButDtorDefault& operator=(const Has3ButDtorDefault &);
68 };
69
70 struct HasEmptyDtor
71 {
72 ~HasEmptyDtor() {} // OK
73 };