Move constant object without compiler warning : <p>I tested the following code using Visual Studio 2017 version 15.3.1. </p>

<p><code>v.push_back(std::move(str1))</code> works as expected. It moves the contents of <code>str1</code> into the vector.</p>

<p><code>str2</code> is a constant string. Since a constant string cannot be modified after it is created, I was expecting that the <code>v.push_back(std::move(str2))</code> statement would result in a compiler warning. However, to my surprise there was no compiler warning.  After stepped into it, I found that the overload of <code>push_back(const T&amp;)</code> was actually called.  The <code>std::move</code> in <code>std::move(str2)</code> seems has no effect.</p>

<p>My question: Should a compiler warning be given for trying to move a constant object?</p>

<pre><code>// Compiled with Visual Studio 2017 version 15.3.1
std::vector&lt;std::string&gt; v;

std::string str1 = "string 1";
v.push_back(std::move(str1));
// Call push_back(T&amp;&amp;). The contents of str1 is moved into the vector.
// This is less expensive, but str1 is now valid but unspecified.

const std::string str2 = "string 2";
v.push_back(std::move(str2));
// Call push_back(const T&amp;). A copy of str2 is added into the vector.
// str2 itself is unchanged.
</code></pre>
