1.. title:: clang-tidy - performance-move-const-arg 2 3performance-move-const-arg 4========================== 5 6The check warns 7 8- if ``std::move()`` is called with a constant argument, 9 10- if ``std::move()`` is called with an argument of a trivially-copyable type, 11 12- if the result of ``std::move()`` is passed as a const reference argument. 13 14In all three cases, the check will suggest a fix that removes the 15``std::move()``. 16 17Here are examples of each of the three cases: 18 19.. code-block:: c++ 20 21 const string s; 22 return std::move(s); // Warning: std::move of the const variable has no effect 23 24 int x; 25 return std::move(x); // Warning: std::move of the variable of a trivially-copyable type has no effect 26 27 void f(const string &s); 28 string s; 29 f(std::move(s)); // Warning: passing result of std::move as a const reference argument; no move will actually happen 30 31Options 32------- 33 34.. option:: CheckTriviallyCopyableMove 35 36 If `true`, enables detection of trivially copyable types that do not 37 have a move constructor. Default is `true`. 38