RAD Studio
ContentsIndex
PreviousUpNext
E2363: Attempting to return a reference to local variable 'identifier' (C++)

This C++ function returns a reference type, and you are trying to return a reference to a local (auto) variable. 

This is illegal, because the variable referred to disappears when the function exits. 

You can return a reference to any static or global variable, or you can change the function to return a value instead.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!