Skip to content

Commit 813b416

Browse files
authored
Merge pull request #797 from rak3-sh/rp/fix-796
Fix #796 (A13-3-1) - Consider reporting overloaded functions that are at different locations.
2 parents 5c5bb64 + 56d886e commit 813b416

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

change_notes/2024-11-13-fix-fp-796.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `A13-3-1` - `FunctionThatContainsForwardingReferenceAsItsArgumentOverloaded.ql`:
2+
- Reduce false positives by explicitly checking that the locations of overloaded functions are different.

cpp/autosar/src/rules/A13-3-1/FunctionThatContainsForwardingReferenceAsItsArgumentOverloaded.ql

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import cpp
1616
import codingstandards.cpp.autosar
17+
import codingstandards.cpp.FunctionEquivalence
1718

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

0 commit comments

Comments
 (0)