Skip to content

A13-3-1: exclude functions with different number parameters #514

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

Merged
merged 10 commits into from
Feb 8, 2024
2 changes: 2 additions & 0 deletions change_notes/2024-01-30-exclusion-a13-3-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`A13-3-1`: `cpp/autosar/function-that-contains-forwarding-reference-as-its-argument-overloaded`
- Fixes #399. Exclude functions that have different number of parameters.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ where
not isExcluded(f,
OperatorsPackage::functionThatContainsForwardingReferenceAsItsArgumentOverloadedQuery()) and
not f.isDeleted() and
f = c.getAnOverload()
f = c.getAnOverload() and
//allow for overloading with different number of parameters
f.getNumberOfParameters() = c.getNumberOfParameters()
select f, "Function overloads a $@ with a forwarding reference parameter.", c, "function"
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
| test.cpp:50:3:50:3 | A | Function overloads a $@ with a forwarding reference parameter. | test.cpp:47:3:47:3 | A | function |
| test.cpp:63:8:63:8 | B | Function overloads a $@ with a forwarding reference parameter. | test.cpp:66:3:66:3 | B | function |
| test.cpp:63:8:63:8 | B | Function overloads a $@ with a forwarding reference parameter. | test.cpp:66:3:66:3 | B | function |
| test.cpp:71:7:71:7 | C | Function overloads a $@ with a forwarding reference parameter. | test.cpp:74:25:74:25 | C | function |
| test.cpp:71:7:71:7 | C | Function overloads a $@ with a forwarding reference parameter. | test.cpp:74:25:74:25 | C | function |
8 changes: 7 additions & 1 deletion cpp/autosar/test/rules/A13-3-1/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ struct B {
B(T &&value) {}
};

int main() {}
int main() {}

class C {
public:
C() {} // COMPLIANT by exception
template <typename T> C(T &&) {}
};