std::is_same result with lvalue and rvalue reference
<p>I was playing with std::is_same utility function in combination with rvalue and lvalue reference and came across a weird behavior.</p>

<p>Consider this function template which checks the type of variable t.</p>

<p>I am using VS 2013 :</p>

<pre><code>struct Test {};

template &lt; class T&gt; void h(T &amp;&amp; t)
{ 
    cout &lt;&lt; " Is type &amp;&amp;: " &lt;&lt; std::is_same&lt;decltype(t), T &amp;&amp;&gt;::value &lt;&lt; endl;
    cout &lt;&lt; " Is type &amp;: " &lt;&lt; std::is_same&lt;decltype(t), T &amp;&gt;::value &lt;&lt; endl;
}
</code></pre>

<p>I observe the following outputs :</p>

<pre><code>h(Test()); // is type &amp;&amp; : 1  is type &amp; : 0
</code></pre>

<p>which is normal for now as Test() is a temporary object, and the universal reference in parameter of h resolves to a r value reference (&amp;&amp; &amp;&amp; = &amp;&amp;)</p>

<p>but consider this :</p>

<pre><code>Test myTest;
h(myTest); // is type &amp;&amp; : 1  is type &amp; : 1 !!!
</code></pre>

<p>same result if i write :</p>

<pre><code>Test &amp;myTest = Test():
h(myTest); // is type &amp;&amp; : 1  is type &amp; : 1 !!!
</code></pre>

<p>and same with :</p>

<pre><code>Test &amp;&amp;myTest = Test():
h(myTest); // is type &amp;&amp; : 1  is type &amp; : 1 !!!
</code></pre>

<p>AM I missing something ? It looks like a complete mess to me :) Are the features rvalue reference / decltype not fully supported in VS 2013?</p>

<p>thanks for your help</p>

<p>Romain</p>