In the following code, is the only way to avoid a compilation error and enable the Bh implementation of the constructor / move destination manually in A.cpp?
#include <memory>
class B;
class A
{
public:
A() = default;
~A() = default;
A(const A&) = delete;
A& operator=(const A&) = delete;
A(A&&) = default;
A& operator=(A&&) = default;
private:
std::unique_ptr<B> m_b;
};
Visual Studio 2015 gives "error C2027: use of type undefined" because the constructor / destination operator std :: unique_ptr calls deleter on m_b (tries to call the B destructor), which is obviously unknown at this point.
source
share