title: Resolution of function arguments/parameters in C++
body: <p>I am currently working my way through 'Effective Modern C++' to update my knowledge of the language, and have just finished item 27, which deals with overloading functions which take forwarding (or universal as the book calls them) references. Using the following code I wrote:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  template &lt;typename T&gt;
  void func(T&amp;&amp; param) {
      std::cout &lt;&lt; "forwarding reference version\n";
  }
  
  void func(int param) {
      std::cout &lt;&lt; "int version\n";
  }
  
  int main() {
      func(29);
  }
  </code></pre>
  
  <p>Please can someone explain why the int version is called, even though 29 is an rvalue and therefore the template should instantiate to "void func(int&amp;&amp; param)" and the call should be to the forwarding version? Obviously it is what it is so my understanding is clearly lacking, but clarification on this point would be helpful. I understand that the standard says in the case of identical function signatures, a non-templated function should be preferred, but (in my mind at least) this doesn't apply here? Many thanks.</p>
  
  <p>Regards,
  Phil</p>