I have a class like the following:
class C {
public:
C() : ... {}
~C() {}
Member_1 m_1;
// ...
Member_N m_N;
};
The two special member functions shown are the only ones declared.
Now,
static_assert(std::is_nothrow_move_assignable<Member_1>::value);
// ...
static_assert(std::is_nothrow_move_assignable<Member_N>::value);
are all satisfied. Yet,
static_assert(std::is_nothrow_move_assignable<C>::value);
asserts. If I remove the empty destructor, it passes.
What does the destructor have to do with the move assignment operator? New Rule of Five?
Compiler is GCC 4.9.3 with -std=c++0x
(for historic reasons).
A user-declared destructor suppresses the implicit generation of move special member functions ([class.copy]/p9, 20). Thus,
C
only has a copy constructor and a copy assignment operator; the latter is used to perform the "move" assignment, and presumably could throw.