/home/bcombee/result_test.cpp:10:9:error:uninitvar:Uninitialized variable: result
/home/bcombee/result_test.cpp:7:0:style:unreadVariable:Variable 'exit' is assigned a value that is never used.
however, result is defined since one of the two sides of the conditional will assign to it. Removing the "auto exit" line will result in passing code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for reporting this.
The false positive also goes away if i change auto exit = [=]{ }; to for example auto exit = 1;. So it could be that the lambda expression confuses Cppcheck here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
gives
/home/bcombee/result_test.cpp:10:9:error:uninitvar:Uninitialized variable: result
/home/bcombee/result_test.cpp:7:0:style:unreadVariable:Variable 'exit' is assigned a value that is never used.
however, result is defined since one of the two sides of the conditional will assign to it. Removing the "auto exit" line will result in passing code.
Thanks for reporting this.
The false positive also goes away if i change
auto exit = [=]{ };
to for exampleauto exit = 1;
. So it could be that the lambda expression confuses Cppcheck here.I have not found a ticket describing this FP already so i created one: https://trac.cppcheck.net/ticket/9303