- Notifications
You must be signed in to change notification settings - Fork70
Closed
Description
Affected rules
A13-5-2
Description
TheA13-5-2 (cpp/autosar/user-defined-conversion-operators-not-defined-explicit) rule triggers on lambda with empty captures.
Example
int ref_value{0};int other_value{0};// okauto dummy_lambda = [&ref_value]()noexcept ->void { ref_value =42; };dummy_lambda();// okauto my_lambda_1 = [&ref_value](int param)noexcept ->void {for (int i{0}; i < param; ++i) { ++ref_value; }};my_lambda_1(other_value);// error: user-defined-conversion-operators-not-defined-explicitauto my_lambda_2 = [](int param)noexcept ->void {for (int i{0}; i < param; ++i) {// }};my_lambda_2(other_value);// okauto my_lambda_3 = [&ref_value](int param)noexcept ->void { ref_value = param; };my_lambda_3(other_value);