`A12-1-1`: Does not apply transitively

Open
#829 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
devtools

Research direction

Start by locating the implementation of rule A12-1-1, cpp/autosar/explicit-constructor-base-class-initialization, and compare its behavior with the two-constructor example in the issue. Determine whether the rule should accept the transitive constructor call, then verify the expected result with the rule's existing tests or add a focused case if the test location is found.

Written by the indexing model from the issue text.

Description

Difficulty-Low false positive/false negative false-positive Impact-Medium Standard-AUTOSAR user-report
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`
};
Dominant language
CodeQL
Stars
227
Forks
82
Avg merge
6d 7h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-coding-standards

All issues in github/codeql-coding-standards

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.