That is because a temporary can not bind to a non-const reference.
double &m = a;
a is of type
int and is being converted to
double. So a temporary is created. Same is the case for user-defined types as well.
Foo &obj = Foo(); // You will see the same error message.
But in Visual Studio, it works fine because of a compiler extension enabled by default. But GCC will complain.