struct A
{
A();
A(const A&);
A& operator =(const A&);
A(A&&) = delete;
A& operator =(A&&) = delete;
};
struct B
{
B();
B(const B&);
B& operator =(const B&);
};
int main()
{
A a;
a = A(); // error C2280
B b;
b = B(); // OK
}
My compiler is VC++ 2013 RC.
error C2280: 'A &A::operator =(A &&)' : attempting to reference a deleted function
I just wonder why the compiler doesn't try A& operator =(const A&);
when A& operator =(A&&)
is deleted?
Is this behavior defined by the C++ standard?
See Question&Answers more detail:os