2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / dtor10.C
blob81ed0c1ac89761c04aae72908360fceafaf104b4
1 // { dg-do run  }
2 // Origin: Mark Mitchell <mark@codesourcery.com>
4 extern "C" void abort ();
6 int j;
8 struct S {
9   static S* s[5];
11   S () { s[j++] = this; }
12   S (const S&) { s[j++] = this; }
13   ~S () { 
14     for (int k = 0; k < j; ++k)
15       if (s[k] == this)
16         return;
17     abort ();
18   }
21 S* S::s[5];
23 struct T {
24   int i;
25   S s;
28 T t;
30 T f () {
31   return t;
34 void g (S) {
37 int main ()
39   g (f ().s);