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

A13-3-1: Ignore false overloads with the same parameter type #406

Open
lcartey opened this issue Oct 6, 2023 · 1 comment · May be fixed by #638
Open

A13-3-1: Ignore false overloads with the same parameter type #406

lcartey opened this issue Oct 6, 2023 · 1 comment · May be fixed by #638
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 Phase III user-report Issue reported by an end user of CodeQL Coding Standards

Comments

@lcartey
Copy link
Collaborator

lcartey commented Oct 6, 2023

Affected rules

  • A13-3-1

Description

getAnOverload() produces incorrect results when files are extracted multiple times in different contexts. To avoid producing false positives, we should exclude cases where the "overload" has the same parameter type (i.e. an r-value reference type) as the original function being overloaded.

Example

template <typename... T> void suppress_unused_warning(T &&...) {}
@lcartey lcartey added false positive/false negative An issue related to observed false positives or false negatives. user-report Issue reported by an end user of CodeQL Coding Standards labels Oct 6, 2023
@lcartey lcartey changed the title A13-3-1: Function with forwarding parameter erroneously reported A13-3-1: Ignore false overloads with the same parameter type Jun 6, 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 labels Jun 6, 2024
@knewbury01 knewbury01 self-assigned this Jul 11, 2024
@knewbury01
Copy link
Contributor

was not sure if this had to do with instantiations of the template in the database looking like separate functions,

however, cannot replicate with:

template <typename T> void suppress_unused_warning(T &&...) {}

int test_406() {
  suppress_unused_warning(1);
  suppress_unused_warning("test");
}

this might have to do with the implicit copy/move constructors... which technically the examples in the rule from the standard doc only show alerts when there are explicit overloads (not involving the implicit copy/move ctors) , so I have chosen to omit those for this

@knewbury01 knewbury01 linked a pull request Jul 12, 2024 that will close this issue
30 tasks
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 Phase III user-report Issue reported by an end user of CodeQL Coding Standards
Projects
Status: Ready for review
Development

Successfully merging a pull request may close this issue.

2 participants