OSDN Git Service

* lib/gcc-dg.exp (dg-skip-if): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / store-expr2.C
1 // { dg-do run { target i?86-*-* } }
2 // { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } }
3 // { dg-options "-mtune=i686 -O2" }
4 class G {};
5
6 struct N {
7   N *a;
8 };
9
10 struct V {
11   typedef N *W;
12   W *m, *n;
13   int s() const { return int(n - m); }
14   const W &operator[](int x) const { return *(m + x); }
15 };
16
17 struct H;
18
19 struct J {
20   N *c;
21   H *d;
22   J(N *x, H *y) : c(x), d(y) {}
23 };
24
25 struct K {
26   const N *c;
27   const H *d;
28   K(const N *x, const H *y) : c(x), d(y) {}
29   K(const J &x) : c(x.c), d(x.d) {}
30 };
31
32 struct H {
33   V e;
34   int f;
35
36   J u()
37   {
38     for (int x = 0; x < e.s(); ++x)
39       if (e[x])
40         return J(e[x], this);
41     return v();
42   }
43   J v() { return J((N*)64, this); }
44 };
45
46 struct I {
47   H d;
48   J u() { return d.u(); }
49   J v() { return d.v(); }
50 };
51
52 struct bar {
53   virtual ~bar() {}
54 };
55
56 struct E {
57   K g;
58   E(K x) : g(x) {}
59 };
60
61 struct foo : public bar {
62   K h;
63   E i;
64   foo(const K x, const E &y) : h(x), i(y) {}
65 };
66
67 struct A {
68   I *l;
69   foo *baz() const;
70 };
71
72 foo *A::baz() const
73 {
74   return new foo(l->u(), E(l->v()));
75 }
76
77 A x;
78 I i;
79 foo *f;
80
81 int main ()
82 {
83   x.l = &i;
84   f = x.baz();
85   if (f->h.c != f->i.g.c || f->h.d != f->i.g.d)
86     return 1;
87   return 0;
88 }