Skip to content

A12-8-6: Consider templates when determining base types #392

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

Closed
lcartey opened this issue Oct 4, 2023 · 0 comments · Fixed by #549
Closed

A12-8-6: Consider templates when determining base types #392

lcartey opened this issue Oct 4, 2023 · 0 comments · Fixed by #549
Assignees
Labels
Difficulty-High A false positive or false negative report which is expected to take 1+ week effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@lcartey
Copy link
Collaborator

lcartey commented Oct 4, 2023

Affected rules

  • A12-8-6

Description

The type hierarchy of templates and template specializations is not considered when determining base types.

Example

template <class T1> class BaseClass7 {
public:
  BaseClass7() {}
  BaseClass7(BaseClass7 const &) = default;            // NON_COMPLIANT
  BaseClass7(BaseClass7 &&) = default;                 // NON_COMPLIANT
  BaseClass7 &operator=(BaseClass7 const &) = default; // NON_COMPLIANT
  BaseClass7 &operator=(BaseClass7 &&) = default;      // NON_COMPLIANT
  int operator=(int i); // COMPLIANT - not an assignment operator
};                      // COMPLIANT

template <class T>
class DerivedClass7 // COMPLIANT - not a base class itself
    : public BaseClass7<T> {
public:
  DerivedClass7() {}
};

void test() {
  BaseClass7<int> b;
  DerivedClass7<int> d;
}
@lcartey lcartey added Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium user-report Issue reported by an end user of CodeQL Coding Standards Difficulty-High A false positive or false negative report which is expected to take 1+ week effort to address and removed Difficulty-Medium A false positive or false negative report which is expected to take 1-5 days effort to address labels Oct 4, 2023
@rvermeulen rvermeulen self-assigned this Feb 8, 2024
@rvermeulen rvermeulen moved this from Triaged to Scheduled in Coding Standards Public Development Board Feb 8, 2024
@rvermeulen rvermeulen moved this from Scheduled to In Progress in Coding Standards Public Development Board Mar 1, 2024
@rvermeulen rvermeulen mentioned this issue Mar 2, 2024
30 tasks
@rvermeulen rvermeulen moved this from In Progress to Ready for review in Coding Standards Public Development Board Mar 4, 2024
@knewbury01 knewbury01 moved this from Ready for review to Review in progress in Coding Standards Public Development Board Mar 8, 2024
@knewbury01 knewbury01 moved this from Review in progress to Reviewed in Coding Standards Public Development Board Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty-High A false positive or false negative report which is expected to take 1+ week effort to address false positive/false negative An issue related to observed false positives or false negatives. Impact-Medium user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

Successfully merging a pull request may close this issue.

2 participants