Hello,

First post, be gentle ;-)

I'm trying to find a clean solution to an error message that clang-tidy is
giving, tried with 10 and 11)

This is the code:

struct Foo
{
    Foo(const std::string &value) : m_name(value) {}
    Foo(std::string &&value) : m_name(std::move(value)) {}
    std::string m_name;
};

The message is :

warning: pass by value and use std::move [modernize-pass-by-value]
    Foo(const std::string &value) : m_name(value) {}
        ^~~~~~~~~~~~~~~~~~~
        std::string                        std::move( )

I understand the logic behind the warning.  Unfortunately the solution
cannot be apply because of the move constructor. Won't compile.  One might
argue the move constructor could be remove. But I did not make that post to
get into that.  What I would like to know if it would make sense to make
clang-tidy smarter about this and not generate that message if a move
constructor is present ?

Regards,

- Mario
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to