Menu

False positive using lambda

2020-06-12
2020-06-13
  • Sébastien Gallou

    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

     
  • Daniel Marjamäki

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.