Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A12-1-1: Does not apply transitively #829

Open
nbusser-sr opened this issue Dec 23, 2024 · 0 comments
Open

A12-1-1: Does not apply transitively #829

nbusser-sr opened this issue Dec 23, 2024 · 0 comments
Labels
false positive/false negative An issue related to observed false positives or false negatives.

Comments

@nbusser-sr
Copy link

nbusser-sr commented Dec 23, 2024

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`
};
@nbusser-sr nbusser-sr added the false positive/false negative An issue related to observed false positives or false negatives. label Dec 23, 2024
@nbusser-sr nbusser-sr changed the title A12-1-1 : Does not apply transitively A12-1-1: Does not apply transitively Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false positive/false negative An issue related to observed false positives or false negatives.
Projects
None yet
Development

No branches or pull requests

1 participant