Hi, surprisingly the following code generates an error:
#include <utility>
struct A
{
A & operator=(A &&);
A & operator=(A const &) = delete;
};
struct B
{
A a;
};
int main()
{
B b1, b2;
b1 = std::move(b2); // calls B's implicitly-declared move assignment operator which should call A's move assignment operator
return 0;
}
The error report is: function "A::operator=(const A &)" (declared at line 5) cannot be referenced -- it is a deleted function
The compiler wants to call A's copy assignment operator. I think this is not correct.
What do you think?