I appreciate the C++11 standard dictates:
If the class definition does not explicitly declare a copy constructor, one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defined as defaulted.
(actually copied from here)
The following code:
#include <iostream>
struct C
{
int x = 1;
C()
{
}
C(C&&)
{
}
};
int main()
{
const C c;
C c2(c);
std::cout << c.x << " " << c2.x << std::endl;
return 0;
}
does not compile on gcc 4.9.0
, but compiles just fine on Visual Studio 2013 (Compiler Version 18.00.21005.1 for x86
). Is this yet another Visual Studio violation of the standard, or am I doing something wrong this time? If this is a violation of the standard, is there a tracking bug or any source where this behaviour is documented?