This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

destructor of static object not called


Hi,

The code

        #include <iostream>
	struct A {
	    void f(){};
	    A(){ std::cout << 1 << endl; }
	    ~A(){ for(;;); std::cout << 2 << endl;}
	};
	template<class T>
	struct B {
	    B(){ a.f(); }
	    static A a;
	};
	template <class T>
	A B<T>::a;
	int main()
	{
	    B<int> b;
	}




gives the output

	1

but should give  

	1
	2
. 

Regards,
Thomas Kunert

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]