title: Why do I get the error "no matching function for call to A::A(A)" on Linux but not on Windows
body: <p>The following code raises an error on Linux when I compile with <code>g++ test.cpp</code>:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class A
  {
  public:
      A(){
          cout &lt;&lt; "call A()" &lt;&lt; endl;
      };
      A&amp; operator = (const A&amp; a) {
          cout &lt;&lt; "call operator =" &lt;&lt; endl;
          return *this;
      }
      A(A&amp; a) {
          cout &lt;&lt; "call A(A&amp; a)" &lt;&lt; endl;
      }
  };
  
  A operator - (A&amp; a1, A&amp; a2)
  {
      cout &lt;&lt; "call operate -" &lt;&lt; endl;
      return a1;
  }
  
  int main()
  {
      A a1;
      A a2;
      A a3 = a1 - a2;
      //a1 = a2;
      return 0;
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>test.cpp: In function ‘int main()’:
  test.cpp:30: error: no matching function for call to ‘A::A(A)’
  test.cpp:15: note: candidates are: A::A(A&amp;)
  test.cpp:8: note:                 A::A()
  </code></pre>
  
  <p>But it works on Windows when compiling with Visual Studio 2010. Why? What's wrong with my code on Linux?</p>