#include <iostream> struct Foo { //Foo() {}; ~Foo() { std::cout << "Destructor was called" << std::endl; } }; void main() { Foo &r = Foo(); }