Affected rules
A12-1-1: cpp/autosar/explicit-constructor-base-class-initialization
Rule A12-1-1 (required, implementation, automated)
Constructors shall explicitly initialize all virtual base classes, all direct
non-virtual base classes and all non-static data members.
Description
⚠️ I'm not 100% sure if the rule actually allows transitive calls to constructors ⚠️
Let an inherited class having two constructor a and b.
a calls the base class constructor while b calls a.
A12-1-1 gets reported on b because it does not call base class constructor directly (but it calls it transitively through a)
Example
class BaseClass {
public:
BaseClass() noexcept = default;
};
class Class final : public BaseClass {
public:
Class(void) noexcept : BaseClass() {};
Class(bool) noexcept : Class() {}; // Triggers `A12-1-1`
};
Affected rules
A12-1-1:cpp/autosar/explicit-constructor-base-class-initializationDescription
Let an inherited class having two constructor
aandb.acalls the base class constructor whilebcallsa.A12-1-1gets reported onbbecause it does not call base class constructor directly (but it calls it transitively througha)Example