#include <iostream> using namespace std; class foo{ public: foo(){} int a; }; foo CreateFoo(){ foo *bar = new foo(); return *bar; } int main() { foo bar = CreateFoo(); delete(bar); return 0; }
Standard input is empty
prog.cpp: In function 'int main()': prog.cpp:18:12: error: type 'class foo' argument given to 'delete', expected pointer delete(bar); ^
Standard output is empty