File tree Expand file tree Collapse file tree 1 file changed +7
-26
lines changed
cpp/autosar/test/rules/A13-5-2 Expand file tree Collapse file tree 1 file changed +7
-26
lines changed Original file line number Diff line number Diff line change @@ -10,34 +10,15 @@ class A {
1010 float d;
1111};
1212
13- void example () {
13+ void test_compiler_generated () {
14+ int x = 0 ;
1415
15- int ref_value{0 };
16- int other_value{0 };
17-
18- // ok
19- auto dummy_lambda = [&ref_value]() noexcept -> void { ref_value = 42 ; };
20- dummy_lambda ();
21-
22- // ok
23- auto my_lambda_1 = [&ref_value](int param) noexcept -> void {
24- for (int i{0 }; i < param; ++i) {
25- ++ref_value;
26- }
27- };
28- my_lambda_1 (other_value);
29-
30- // error: user-defined-conversion-operators-not-defined-explicit
31- auto my_lambda_2 = [](int param) noexcept -> void {
32- for (int i{0 }; i < param; ++i) {
33- //
34- }
16+ auto capture = [x]() -> int {
17+ return x;
3518 };
36- my_lambda_2 (other_value);
3719
38- // ok
39- auto my_lambda_3 = [&ref_value]( int param) noexcept -> void {
40- ref_value = param ;
20+ auto no_capture = []() -> int {
21+ int x = 1 ;
22+ return x ;
4123 };
42- my_lambda_3 (other_value);
4324}
You can’t perform that action at this time.
0 commit comments