Debian Codegraph @

llvm-project/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst

raw
1 .. title:: clang-tidy - bugprone-copy-constructor-init
2
3 bugprone-copy-constructor-init
4 ==============================
5
6 Finds copy constructors where the constructor doesn't call
7 the copy constructor of the base class.
8
9 .. code-block:: c++
10
11 class Copyable {
12 public:
13 Copyable() = default;
14 Copyable(const Copyable &) = default;
15 };
16 class X2 : public Copyable {
17 X2(const X2 &other) {} // Copyable(other) is missing
18 };
19
20 Also finds copy constructors where the constructor of
21 the base class don't have parameter.
22
23 .. code-block:: c++
24
25 class X4 : public Copyable {
26 X4(const X4 &other) : Copyable() {} // other is missing
27 };
28
29 The check also suggests a fix-its in some cases.