summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/dtor10.C
blob: 81ed0c1ac89761c04aae72908360fceafaf104b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// { dg-do run  }
// Origin: Mark Mitchell <mark@codesourcery.com>

extern "C" void abort ();

int j;

struct S {
  static S* s[5];

  S () { s[j++] = this; }
  S (const S&) { s[j++] = this; }
  ~S () { 
    for (int k = 0; k < j; ++k)
      if (s[k] == this)
	return;
    abort ();
  }
};

S* S::s[5];

struct T {
  int i;
  S s;
};

T t;

T f () {
  return t;
}

void g (S) {
}

int main ()
{
  g (f ().s);
}