[cfe-users] clang-tidy

JVApen via cfe-users cfe-users at lists.llvm.org
Wed Feb 5 03:34:41 PST 2020


Hey Mario,

I logged a bug for this a long time ago:
https://bugs.llvm.org/show_bug.cgi?id=25319
>From what I can see, this still ain't solved.

It makes sense to register you onto that one.

On Thu, Jan 30, 2020, 19:02 Mario Charest via cfe-users <
cfe-users at lists.llvm.org> wrote:

> 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 at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20200205/39ab5599/attachment.html>


More information about the cfe-users mailing list