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-0-1: Class templates raise false positives #8

Closed
nicolaswill opened this issue Jul 15, 2022 · 1 comment
Closed

A12-0-1: Class templates raise false positives #8

nicolaswill opened this issue Jul 15, 2022 · 1 comment
Assignees
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. Impact-Medium irrceproducable The described issue cannot be reproduced. user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@nicolaswill
Copy link
Contributor

Affected rules

  • A12-0-1

Description

Class templates raise false positives even if all special member functions are defined. Identical classes (which are not class templates) do not result in a false-positive result.

Example

template<typename T>
class A12_0_1a { // <= A12-0-1 error here
 public:
  explicit A12_0_1a(T i) : i_(i) {}
  A12_0_1a(const A12_0_1a&) = delete;
  A12_0_1a(A12_0_1a&&) = delete;
  A12_0_1a& operator=(const A12_0_1a&) = delete;
  A12_0_1a& operator=(A12_0_1a&&) = delete;
  virtual ~A12_0_1a() = default;
 private:
  T i_;
};
class A12_0_1b { // <= No A12-0-1 error here
 public:
  explicit A12_0_1b(int i) : i_(i) {}
  A12_0_1b(const A12_0_1b&) = delete;
  A12_0_1b(A12_0_1b&&) = delete;
  A12_0_1b& operator=(const A12_0_1b&) = delete;
  A12_0_1b& operator=(A12_0_1b&&) = delete;
  virtual ~A12_0_1b() = default;
 private:
  int i_;
};
@nicolaswill nicolaswill 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/false negative An issue related to observed false positives or false negatives. labels Jul 15, 2022
@rvermeulen rvermeulen self-assigned this Jan 10, 2024
@rvermeulen
Copy link
Collaborator

I'm unable to replicate this case. It could have been resolved through extractor updates that resulted in more accurate information, because the query hasn't been updated to account for uninitialized templates. Will close for now.

@rvermeulen rvermeulen added the irrceproducable The described issue cannot be reproduced. label Jan 12, 2024
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. Impact-Medium irrceproducable The described issue cannot be reproduced. user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Development

No branches or pull requests

2 participants