title: A code which seems wrong being compiled (about object return)
body: <p>Recently someone asked me a question about the constructing of a return value of a function. After a few of discussions I found that something seems not right. Here is the sample:</p>
  
  <pre><code>#include &lt;conio.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  
  /*
  struct A // Won't be compiled
  {
      A(void) {};
      A(const A &amp;) {};
      A(A &amp;&amp;) = delete;
  };
  */
  
  struct A // Compiled but...
  {
      A(void) {};
      A(const A &amp;) = delete;
      A(A &amp;&amp;) {};
  };
  
  A func(void)
  {
      A temp;
  
      return temp;// 'temp' is a named object, so it should be a lvalue and the A(const A &amp;) should have been invoked.
      //return std::move(temp); // OK.
  }
  
  int main(void)
  {
      func();
  
      _getch();
      return(0);
  }
  </code></pre>
  
  <p>It will be compiled (either by VC or by gcc)... But it looks wrong.</p>
  
  <p>The question is: Even any copy-deducing condition has been triggered, There seems no reason to let the 'A(const A &amp;)' be ignored, isn't it?</p>