struct S {
	void f() {}
};

template<typename T>
void call(T* t, void (T::*fn)())
{
	(t->*fn)();
	delete t;
}

int main() {
	call(new S, &S::f);
}