title: Why Can const lvalue References Refer to Mutable rvalue References?
body: <p>In C++11 a const lvalue reference can be initialized with a mutable rvalue reference.  The value referred to by the rvalue can then change producing a visible mutation to what the const lvalue is referring to.  Here is an example: </p>
  
  <pre><code>int &amp;&amp; rval = 3;
  const int &amp; lval = rval;
  
  cout &lt;&lt; "lval = " &lt;&lt; lval &lt;&lt; endl;
  cout &lt;&lt; "rval = " &lt;&lt; rval &lt;&lt; endl;
  
  rval ++;
  
  cout &lt;&lt; "lval = " &lt;&lt; lval &lt;&lt; endl;
  </code></pre>
  
  <p>Output (from clang 3.2 and gcc 4.8.2 both with -std=c++11):</p>
  
  <pre><code>lval = 3
  rval = 3
  lval = 4
  </code></pre>
  
  <p>I would <em>guess</em> the reason for this is that the referent cannot be modified <strong>through</strong> the lvalue reference but it can be modified through the rvalue reference.  But, I don't understand why a const lvalue is allowed to refer to a mutable object.</p>
  
  <p>Can someone explain the rationale for this and give best practices for when dealing with such a situation.  Also, are there other similar examples where constness can be subverted?</p>