Es geht um das statische Objekt singleton::i. Der d'tor wird scheinbar nicht aufgerufen. Zumindest erfolgt keine Ausgabe, wenn man eine darin plaziert. Laut valgrind gibt es auch keine Speicherlecks. Wann also wird das Objekt zestoert?
template<typename T> class singleton { static T* i; protected: singleton() { } singleton(T* t) { i = t; } singleton(const singleton& s) { } singleton& operator=(const singleton&s ) { return *this; } ~singleton() { i = 0; } public: static T& instance() { if (i == 0) i = new T; return *singleton::i; } static T* instance_ptr() { if (i == 0) i = new T; return singleton::i; } }; class Blah : public singleton<Blah> { int a, b; Blah(int c = 0, int d = 1) { a = c; b = d; } Blah(const Blah& blah) { ; } Blah& operator=(const Blah& blah) { ; } ~Blah() { ; } protected: friend class singleton<Blah>; }; template<> Blah* singleton<Blah>::i = 0; int main() { Blah* b = Blah::instance_ptr(); }