I have some code where IInterface is an abstract class.
I was writing this
IInterface &q = InterfaceImpl();
and compiled it in Vi
InterfaceImpl()
returns a temporary object (rvalue) that you cannot keep in a non-const reference.
However when you instantiate IInterface i
i becomes an lvalue, So you can keep it in non-const reference.
However binding non-const reference to rvalue is allowed in VS . It has been discussed in this thread