title: C++ - Why is there no suitable constructor to convert from MyClass () to Myclass?
body: <p>For an assignment I need to create a class that can do arbitrary precision arithmetic. This is the simplest definition of the class:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>class MyClass() {
  private:
      std::vector&lt;unsigned char&gt; digits
  public:
      MyClass(); // Default constructor
      MyClass(const MyClass&amp; other); // Copy Constructor
      MyClass(MyClass&amp;&amp; other); // Move Constructor
  
      MyClass(std::vector&lt;unsigned char&gt; digits);
      MyClass(unsigned long long value);
  
  // Arithmetic and comparison operators defined below...
  </code></pre>
  
  <p>I was attempting to implement the multiplication operator, which has the signature <code>MyClass operator*(const MyClass&amp; other)</code>, when I found that this code causes a compiler error:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>MyClass rv();
  MyClass a(10);
  rv = rv + a;
  return rv;
  </code></pre>
  
  <p>Line 3 errors with <code>Expression must be a modifiable lvalue</code></p>
  
  <p>Line 4 errors with <code>No suitable constructor exists to convert from "MyClass ()" to "MyClass"</code></p>
  
  <p>However, if I change the first line to either <code>MyClass rv;</code> or <code>MyClass rv = MyClass();</code>, the error goes away. Why is this?</p>
  
  <p>I'm using the MSVC compiler on Windows 10.</p>