An example in the book Thinking in C++:
According to the book the compiler should report error because f() returns a temporary object which is defined by the compiler as "const".Code:class X{}; X f() { return X(); } void g1(X&){} void g2(const X&){} int main(){ g1(f()); return 0; }
However I compile this code using VS 2005 it works. Is the book wrong?
Thanks!