title: Why do I need const copy constructor when compiling my code with converting constructor?
body: <p>I have such class in <strong>A.h</strong> :</p>
  
  <pre><code>class A {
  public:
      A(int *object) {
          std::cout &lt;&lt; "convert";
      }
  
      A(A &amp;object) {
          std::cout &lt;&lt; "copy";
      }
  };
  </code></pre>
  
  <p>and in <strong>main.cpp</strong></p>
  
  <pre><code>A a = new int;
  </code></pre>
  
  <p>then, when I'm trying to compile it i get </p>
  
  <blockquote>
    <p>invalid initialization of non-const reference of type ‘A&amp;’ from an
    rvalue of type ‘A’  </p>
  </blockquote>
  
  <p>but when i add <strong>const</strong> to copy-constructor like that:</p>
  
  <pre><code>A(const A &amp;object) {
      std::cout &lt;&lt; "copy";
  }
  </code></pre>
  
  <p>code compiles and "convert" is called. It works when i remove copy constructor, too. Why such thing happen? I though this example has nothing to do with copying constructor as we do not use instance of class A to create another.</p>