Well, there are certain legitimate use cases for assigning an rvalue. To quote from Ref-qualifiers for assignment operators in the standard library:
There are only a few very specific types for which the support assigns an rvalue. In particular, the types that serve as proxies, for example, vector <bool> :: reference, and the types whose purpose the operators have const qualification (for example, slice_array).
The C ++ Standardization Committee obviously believed that the default assignment should not have an implicit reflective qualifier - rather, it should be explicitly declared. Indeed, there may be existing code that will stop working if all of the implicitly declared assignment operators suddenly fail to work with rvalues.
Of course, it's a little hard to come up with an example where we want the implicitly assigned assignment operator to work with rvalues, but the C ++ standard committee probably doesn't want to accept such possibilities when it comes to maintaining backward compatibility. Code like this:
int foo_counter = 0; struct Foo { Foo() { ++foo_counter; } ~Foo() { --foo_counter; } }; int main() { Foo() = Foo(); }
... will no longer work. And at the end of the day, the standards committee wants to make sure that the previous C ++ (no matter how silly or far-fetched) continues to work in C ++ 11.
source share