Oops there is missing declaration of the variable a
. This is what you should be examining:
class A {};
int main() {
A a;
std::cout << &(A() = a) << "\n";
}
@vaporeon_ @wallhackio this is very close but there is some pedantry here
&
) out of the result of the expurression. (no i do not even know how to begin to explain what an lvalue refurence “is”)@vaporeon_ @aescling yes
@vaporeon_ @aescling but the result of A()
is an rvalue, which is not allowed to be given to & or appear on the left side of an assignment. That is the mystifying part here
@aescling @wallhackio > the value of the left side (after assignment) is the value of the assignment expurression
Oh... So will
&(A() = a)
, instead of returning the address ofa
, return the address of the newly-createdA()
?