c++ - VS2010: Temporaries can't be bound to non-const references -
this question has answer here:
- rvalue lvalue conversion visual studio 3 answers
i came know temporaries
connot bound non-const references.
class x { int i; }; x fun() { return x(); } void func(x &x) { } int main() { func(fun()); return 0; }
isn't call fun
producing temporary? why can temporary linked non-const reference
here. unable comprehend why compiling fine.
edit: using vs2010. don't understand how should matter.
isn't call
fun
producing temporary?
yes.
why can temporary linked non-const reference here.
it can't.
i unable comprehend why compiling fine.
because compiler faulty.
i using vs2010. don't understand how should matter.
that compiler has many non-standard "extensions" language. 1 example of dodgy code that's accepted compiler, not conformant one.
Comments
Post a Comment