#include using namespace std; class X { private: int _x; public: X(int x) : _x(x) {}; void x () const { cout << "X\n"; } const X* const funkyCopy() const { const X * const result(this); return result; } private: X(const X&); }; void foobar(const X & x) { x.x(); } int main(int argc, char* argv[]) { X x(0); foobar(x); foobar((X(0).funkyCopy())); //foobar(X(0)); }