c++/523: static object never destructed
kunert@physik.tu-dresden.de
kunert@physik.tu-dresden.de
Mon Sep 11 05:36:00 GMT 2000
>Number: 523
>Category: c++
>Synopsis: static object never destructed
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Mon Sep 11 05:36:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Thomas Kunert
>Release: gcc version 2.96 20000911 (experimental)
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
// This program prints "con", i.e.
// the destructor of B::a is never called
#include <iostream>
struct A {
void f(){};
A(){ std::cout << "con" << endl; }
~A(){ std::cout << "des" << endl;}
};
template<class T>
struct B {
B(){ a.f(); }
static A a;
};
template <class T> A B<T>::a;
int main()
{
B<int> b;
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list