Hi all,
I think I got a false positive on this code :
void fct1(MyClass& object) ==> Parameter 'object' can be declared with const{ fct2(&, object);} bool fct2(std::function<void()> lambdaExpression, MyClass& object){ object.modify();}</void()>
Parameter object is not const in fct2, so must not be const in fct1. The warning disappear if I switch parameters order in fct2 :
void fct1(MyClass& object) ==> No more warning{ fct2(object, &);} bool fct2(MyClass& object, std::function<void()> lambdaExpression){ object.modify();}</void()>
Can you confirm ? Sébastien
Thanks! I created https://trac.cppcheck.net/ticket/9767
Log in to post a comment.
Hi all,
I think I got a false positive on this code :
void fct1(MyClass& object) ==> Parameter 'object' can be declared with const{
fct2(&,
object);}
bool fct2(std::function<void()> lambdaExpression,
MyClass& object){
object.modify();}</void()>
Parameter object is not const in fct2, so must not be const in fct1.
The warning disappear if I switch parameters order in fct2 :
void fct1(MyClass& object) ==> No more warning{
fct2(object,
&);}
bool fct2(MyClass& object,
std::function<void()> lambdaExpression){
object.modify();}</void()>
Can you confirm ?
Sébastien
Thanks! I created https://trac.cppcheck.net/ticket/9767