title: if I am not allowed to assign rvalues to reference why does the following snippet work, how does this work internally?
body: <p>I am playing around with templates and c++ syntax and I noticed that you are able to pass by reference simply by calling add(2,3) when the function is defined as below:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  
  auto add(const int&amp; lhs, const int&amp; rhs)
  {
      return lhs + rhs;
  }
  
  int main()
  {
      cout &lt;&lt; add(2, 3) &lt;&lt; '\n';
      getchar();
      return 0;
  }
  </code></pre>
  
  <p>How come doing this is illegal:</p>
  
  <pre><code>int&amp; r = 3;
  </code></pre>
  
  <p>but I can call add(2,3) without a problem, aren't I doing the same in both cases, assigning a rvalue to a reference?</p>