Why is this code compiling? I thought that rvalues returned by ctor are not located in memory and therefore can't be used as lvalues.
#include <iostream>
#include <vector>
class Y {
public :
explicit Y(size_t num = 0)
: m_resource {std::vector<int>(num)}
{
}
std::vector<int> m_resource;
};
int main(int argc, const char * argv[]) {
Y(1) = Y(0); // WHAT?!?
return 0;
}