This documentation is archived and is not being maintained.

Compiler Warning (level 1) C4354

Visual Studio .NET 2003

'reference' : initialization of reference member requires a temporary variable

You tried to initialize a member that was a reference. The compiler creates a temporary stack variable to perform the initialization. Since the stack variable will be eliminated after the termination of the constructor, the pointer will be invalid.

This initialization causes an error under the default Microsoft extensions (/Ze).

To avoid this warning, initialize the member instead of its reference.