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]

Re: destructor of static object not called


Sorry, my code contained a typo. The right code to show the bug is

        #include <iostream>
        struct A {
            void f(){};
            A(){ std::cout << 1 << endl; }
            ~A(){ 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;
       
}                                                                       

Sorry,
Thomas Kunert

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