Skip to content
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`
Comment thread
knewbury01 marked this conversation as resolved.
Outdated
- 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
Comment thread
knewbury01 marked this conversation as resolved.
Outdated
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 |
Comment thread
rvermeulen marked this conversation as resolved.
Outdated
| 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 &&) {}
Comment thread
knewbury01 marked this conversation as resolved.
Outdated
};