Skip to content

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

Closed
@lcartey

Description

@lcartey

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;
}

Metadata

Metadata

Assignees

Labels

Difficulty-HighA false positive or false negative report which is expected to take 1+ week effort to addressImpact-Mediumfalse positive/false negativeAn issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding Standards

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions