Implicit Move Suppression

A class defines a custom copy constructor and copy assignment operator but does not declare any move operations. What happens when you attempt to move an instance of this class?

class Widget {
public:
    Widget() = default;
    Widget(const Widget&) { /* custom copy */ }
    Widget& operator=(const Widget&) { /* custom copy assign */ }
};

Widget a;
Widget b = std::move(a);
A

Undefined behavior; moving without a move constructor is illegal

B

Compile error; move operations are required if copy operations are defined

C

The compiler generates a default move constructor and uses it

D

The copy constructor is called; the compiler does not implicitly generate move operations when copy operations are user-defined