title: Explanation of the C++ template function argument deduction when matching `T const &&t` against `int const *`
body: <p>I don't understand how the argument deduction rule works in this case. I have the following simple code snippet:</p>
  <pre><code>template&lt;typename T&gt;
  void fn(T const &amp;&amp;t) {
     std::cout &lt;&lt; __PRETTY_FUNCTION__  &lt;&lt; std::endl;
     std::cout &lt;&lt; typeid(decltype(t)).name() &lt;&lt; std::endl;
  }
  int main() {
     int const *ar = nullptr;
     std::cout &lt;&lt; typeid(ar).name() &lt;&lt; std::endl;
     fn(std::move(ar));
  }
  </code></pre>
  <p>The result I get is as follows:</p>
  <pre><code>PKi
  void fn(const T &amp;&amp;) [T = const int *]
  PKi
  </code></pre>
  <p>What I don't understand is why <code>T</code> is inferred as <code>const int *</code>. Why the <code>const</code> did not get pattern matched?</p>