The following code is correct in my opinion and the variable is definitely used. Nevertheless, it generates a warning, because probably the init-statements in the if (since C++17) are not considered.
voidf(){// warning: Unused variable value 'value' [constStatement]if(SomeObjvalue;someFunc(value)){std::cout<<value.str();}}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The following code is correct in my opinion and the variable is definitely used. Nevertheless, it generates a warning, because probably the init-statements in the if (since C++17) are not considered.
Thanks! I can reproduce, I created https://trac.cppcheck.net/ticket/9776