Recently while reading blog on universal reference by scott meyers i came along statement that "if you can take the address of an expression, the expression is an lvalue." but is this really true
Suppose i have following code
class Test
{
};
int main()
{
std::cout << "Address is " << &(Test()) << std::endl;
Test() = Test();
Test&& t = Test();
return 0;
}
In above case Test() is temporary i.e rvalue and i am able to take address of that (with gcc we can use -fpremissive and with msvc it will compile directly) so with this we can say it is lvalue and also bcoz we can do Test() = Test() but since we can take rvalue reference to it so it should be rvalue.
So why we always say that if we can take address of variable then it is lvalue ?