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 · 1 comment
Open

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

nbusser-sr opened this issue Dec 23, 2024 · 1 comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. false-positive An issue representing a false positive report. Impact-Medium Standard-AUTOSAR user-report Issue reported by an end user of CodeQL Coding Standards

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
@lcartey lcartey added Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address Impact-Medium user-report Issue reported by an end user of CodeQL Coding Standards false-positive An issue representing a false positive report. Standard-AUTOSAR labels Jan 16, 2025
@lcartey lcartey moved this from Reported to Triaged in Coding Standards Public Development Board Jan 16, 2025
@lcartey
Copy link
Collaborator

lcartey commented Jan 16, 2025

This is not covered explicitly by the rule one way or another, but seems a reasonable extension to permit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-Low A false positive or false negative report which is expected to take <1 day effort to address false positive/false negative An issue related to observed false positives or false negatives. false-positive An issue representing a false positive report. Impact-Medium Standard-AUTOSAR user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

No branches or pull requests

2 participants