1 | // RUN: %check_clang_tidy %s cppcoreguidelines-special-member-functions %t -- -config="{CheckOptions: {cppcoreguidelines-special-member-functions.AllowMissingMoveFunctionsWhenCopyIsDeleted: true}}" -- |
2 | |
3 | class DefinesEverything { |
4 | DefinesEverything(const DefinesEverything &); |
5 | DefinesEverything(DefinesEverything &&); |
6 | DefinesEverything &operator=(const DefinesEverything &); |
7 | DefinesEverything &operator=(DefinesEverything &&); |
8 | ~DefinesEverything(); |
9 | }; |
10 | |
11 | class DefinesNothing { |
12 | }; |
13 | |
14 | class DeletedCopyCtorAndOperator { |
15 | ~DeletedCopyCtorAndOperator() = default; |
16 | DeletedCopyCtorAndOperator(const DeletedCopyCtorAndOperator &) = delete; |
17 | DeletedCopyCtorAndOperator &operator=(const DeletedCopyCtorAndOperator &) = delete; |
18 | }; |
19 | |
20 | // CHECK-MESSAGES: [[@LINE+1]]:7: warning: class 'DefaultedCopyCtorAndOperator' defines a default destructor, a copy constructor and a copy assignment operator but does not define a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] |
21 | class DefaultedCopyCtorAndOperator { |
22 | ~DefaultedCopyCtorAndOperator() = default; |
23 | DefaultedCopyCtorAndOperator(const DefaultedCopyCtorAndOperator &) = default; |
24 | DefaultedCopyCtorAndOperator &operator=(const DefaultedCopyCtorAndOperator &) = default; |
25 | }; |
26 | |
27 | // CHECK-MESSAGES: [[@LINE+1]]:7: warning: class 'DefinedCopyCtorAndOperator' defines a default destructor, a copy constructor and a copy assignment operator but does not define a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] |
28 | class DefinedCopyCtorAndOperator { |
29 | ~DefinedCopyCtorAndOperator() = default; |
30 | DefinedCopyCtorAndOperator(const DefinedCopyCtorAndOperator &); |
31 | DefinedCopyCtorAndOperator &operator=(const DefinedCopyCtorAndOperator &); |
32 | }; |
33 | |
34 | // CHECK-MESSAGES: [[@LINE+1]]:7: warning: class 'MissingCopyCtor' defines a default destructor and a copy assignment operator but does not define a copy constructor, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] |
35 | class MissingCopyCtor { |
36 | ~MissingCopyCtor() = default; |
37 | MissingCopyCtor &operator=(const MissingCopyCtor &) = delete; |
38 | }; |
39 | |
40 | // CHECK-MESSAGES: [[@LINE+1]]:7: warning: class 'MissingCopyOperator' defines a default destructor and a copy constructor but does not define a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] |
41 | class MissingCopyOperator { |
42 | ~MissingCopyOperator() = default; |
43 | MissingCopyOperator(const MissingCopyOperator &) = delete; |
44 | }; |
45 | |
46 | // CHECK-MESSAGES: [[@LINE+1]]:7: warning: class 'MissingAll' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] |
47 | class MissingAll { |
48 | ~MissingAll() = default; |
49 | }; |
50 | |