Why is this code compiling? I thought that rvalues returned by the constructor are not located in memory and therefore can't be used as lvalues.
class Y {
public :
explicit Y(size_t num = 0) {}
};
int main() {
Y(1) = Y(0); // WHAT?!?
return 0;
}
operator=
may be called on any object. Your code is the same asY(1).operator=(Y(0));
– Bladderwort