title: Does an lvalue argument prefer an lvalue reference parameter over a universal reference?
body: <p>While playing with universal references, I came across this instance where clang and gcc disagree on overload resolution.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  struct foo {};
  
  template&lt;typename T&gt;
  void bar(T&amp;) { std::cout &lt;&lt; "void bar(T&amp;)\n"; }
  
  template&lt;typename T&gt;
  void bar(T&amp;&amp;) { std::cout &lt;&lt; "void bar(T&amp;&amp;)\n"; }
  
  int main()
  {
      foo f;
      bar(f);  // ambiguous on gcc, ok on clang
  }
  </code></pre>
  
  <p><a href="http://coliru.stacked-crooked.com/view?id=3455c14b41c46596320c5133c4621e7c-793367a52c22d67c60e8f4d72a2f51e2" rel="nofollow noreferrer">gcc reports</a> the call above is ambiguous. However, <a href="http://coliru.stacked-crooked.com/view?id=3455c14b41c46596320c5133c4621e7c-6e9f1f680880347f6708b805c806db62" rel="nofollow noreferrer">clang</a> selects the <code>T&amp;</code> overload and compiles successfully.</p>
  
  <p>Which compiler is wrong, and why?</p>
  
  <p>Edit: <br/>
  Tested the same code on VS2013 Preview, and it agrees with clang; except Intellisense, which is on gcc's side :-)</p>