title: Compiler thinks that "A(A&)" accepts rvalues for a moment?
body: <p>I have this code</p>
  
  <pre><code>struct A { A(); A(A&amp;); }; 
  struct B { B(const A&amp;); }; 
  
  void f(A); 
  void f(B); 
  
  int main() { 
     f(A()); 
  }
  </code></pre>
  
  <p>To my surprise this fails with GCC and Clang. Clang says for example</p>
  
  <pre><code>Compilation finished with errors:
  source.cpp:8:10: error: no matching constructor for initialization of 'A'
         f(A()); 
           ^~~
  source.cpp:1:21: note: candidate constructor not viable: expects an l-value for 1st argument
      struct A { A(); A(A&amp;); }; 
                      ^
  source.cpp:1:16: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
      struct A { A(); A(A&amp;); }; 
                 ^
  source.cpp:4:13: note: passing argument to parameter here
      void f(A); 
  </code></pre>
  
  <p>Why do they choose the first <code>f</code>, when the second <code>f</code> works fine? If I remove the first <code>f</code>, then the call succeeds. What is more weird to me, if I use brace initialization, <em>it also works fine</em></p>
  
  <pre><code>int main() { 
     f({A()}); 
  }
  </code></pre>
  
  <p>They all call the second <code>f</code>. </p>