// Illustrates that it is dangerous to have a (const) reference to a deallocated variable. // Causes a warning from the compiler. #include #include #include using namespace std; typedef int T; const T& f(double d){ double e = 2 * d; return e; // Compiler warning: // returning reference to temporary } int main(){ double expression = 5.3; const T &var = f(expression); cout << var << endl; // ?? }