summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/crash22.C
blob: 0890aef4a1ed36a06b442e3b514a4c9c9a77eb2d (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// { dg-do link  }
// { dg-options "-O2" }

class foo
{
};

typedef void *voidp;
class vect : public foo
{
public:
  voidp& a();
  int b();
};

class bar
{
public:
  bar *c(bool (*f)(bar *node), voidp g)
    {
      int i=0;
      bool j;
      while (i < d.b()){
        j = (f == __null) || f((bar*)d.a());
        if (j)
          ((bar*)d.a())->c(f, g);
        i++;
      }
      return this;
    }
 public:
  vect d;
  bar *e(foo *k);
};

bar *bar::e(foo *k)
{
  return c(__null, k);
}

voidp &vect::a()
{
  static voidp x;
  return x;
}

int vect::b()
{
  static int x;
  return x;
}

int main()
{
  return 0;
}