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

Fix #796 (A13-3-1) - Consider reporting overloaded functions that are at different locations. #797

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change_notes/2024-11-13-fix-fp-796.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `A13-3-1` - `FunctionThatContainsForwardingReferenceAsItsArgumentOverloaded.ql`:
- Reduce false positives by explicitly checking that the locations of overloaded functions are different.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.FunctionEquivalence

class Candidate extends TemplateFunction {
Candidate() {
Expand All @@ -29,6 +30,8 @@ where
OperatorsPackage::functionThatContainsForwardingReferenceAsItsArgumentOverloadedQuery()) and
not f.isDeleted() and
f = c.getAnOverload() and
// Ensure the functions are not equivalent to each other (refer #796).
not f = getAnEquivalentFunction(c) and
// allow for overloading with different number of parameters, because there is no
// confusion on what function will be called.
f.getNumberOfParameters() = c.getNumberOfParameters() and
Expand Down
Loading