1 .. title:: clang-tidy - readability-redundant-member-init
3 readability-redundant-member-init
4 =================================
6 Finds member initializations that are unnecessary because the same default
7 constructor would be called if they were not present.
14 // Explicitly initializing the member s is unnecessary.
26 .. option:: IgnoreBaseInCopyConstructors
30 When `true`, the check will ignore unnecessary base class initializations
31 within copy constructors, since some compilers issue warnings/errors when
32 base classes are not explicitly initialized in copy constructors. For example,
33 ``gcc`` with ``-Wextra`` or ``-Werror=extra`` issues warning or error
34 ``base class 'Bar' should be explicitly initialized in the copy constructor``
35 if ``Bar()`` were removed in the following example:
39 // Explicitly initializing member s and base class Bar is unnecessary.
40 struct Foo : public Bar {
41 // Remove s() below. If IgnoreBaseInCopyConstructors!=0, keep Bar().
42 Foo(const Foo& foo) : Bar(), s() {}