Skip to content

Commit

Permalink
Merge pull request #797 from rak3-sh/rp/fix-796
Browse files Browse the repository at this point in the history
Fix #796 (A13-3-1) - Consider reporting overloaded functions that are at different locations.
  • Loading branch information
lcartey authored Nov 26, 2024
2 parents 5c5bb64 + 56d886e commit 813b416
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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

0 comments on commit 813b416

Please sign in to comment.