Compiler Warning (level 2) C4720

'initializing' : do not initialize a non-const 'type1' with a non-lvalue 'type2' function return

A nonconst T& was initialized with the value of a function call which returns T. This is an error, because a function call is not an l-value (unless it returns a reference) and a nonconst T& must be initialized with a T l-value. However, when Microsoft extensions have been enabled (/Ze), Visual C++ renders this as a warning because the construction is harmless and because the construction occurs fairly frequently in existing code.

The can be eliminated by changing the reference being initialized to a const T&. The following example causes this warning:

struct X {};
X f();
X&r = f();  // warning