As per the cpp reference cpp-ref, compiler does not generate a default move constructor if we have a user defined destructor.
Code snippet:
class General
{
public:
~General();
General();
void testInitList();
};
int main(int argc, char **argv) {
General b(std::move(General()));
General g = std::move(b);
g.testInitList();
return 0;
}
The code compiles implying that the compiler generated a default move constructor. The code was compiled using gcc version 5.4.0.
Could someone explain why the compiler generated a move constructor and move assignment operator in this case despite have a destructor?
Best, Rahul