1 .. title:: clang-tidy - performance-move-const-arg
3 performance-move-const-arg
4 ==========================
8 - if ``std::move()`` is called with a constant argument,
10 - if ``std::move()`` is called with an argument of a trivially-copyable type,
12 - if the result of ``std::move()`` is passed as a const reference argument.
14 In all three cases, the check will suggest a fix that removes the
17 Here are examples of each of the three cases:
22 return std::move(s); // Warning: std::move of the const variable has no effect
25 return std::move(x); // Warning: std::move of the variable of a trivially-copyable type has no effect
27 void f(const string &s);
29 f(std::move(s)); // Warning: passing result of std::move as a const reference argument; no move will actually happen
34 .. option:: CheckTriviallyCopyableMove
36 If `true`, enables detection of trivially copyable types that do not
37 have a move constructor. Default is `true`.
39 .. option:: CheckMoveToConstRef
41 If `true`, enables detection of `std::move()` passed as a const
42 reference argument. Default is `true`.