Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / store-expr1.C
blob49456242b4edbffb6656ab15509329577d7772e7
1 // { dg-do run { target i?86-*-* } }
2 // { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } }
3 // { dg-options "-mtune=i686 -O2 -fpic" }
4 // { dg-bogus "\[Uu\]nresolved symbol .(_GLOBAL_OFFSET_TABLE_|\[_.A-Za-z\]\[_.0-9A-Za-z\]*@(PLT|GOT|GOTOFF))" "PIC unsupported" { xfail *-*-netware* } 0 }
5 class G {};
7 struct N {
8   N *a;
9 };
11 struct V {
12   typedef N *W;
13   W *m, *n;
14   int s() const { return int(n - m); }
15   const W &operator[](int x) const { return *(m + x); }
18 struct H;
20 struct J {
21   N *c;
22   H *d;
23   J(N *x, H *y) : c(x), d(y) {}
26 struct K {
27   const N *c;
28   const H *d;
29   K(const N *x, const H *y) : c(x), d(y) {}
30   K(const J &x) : c(x.c), d(x.d) {}
33 struct H {
34   V e;
35   int f;
37   J u()
38   {
39     for (int x = 0; x < e.s(); ++x)
40       if (e[x])
41         return J(e[x], this);
42     return v();
43   }
44   J v() { return J((N*)64, this); }
47 struct I {
48   H d;
49   J u() { return d.u(); }
50   J v() { return d.v(); }
53 struct bar {
54   virtual ~bar() {}
57 struct E {
58   K g;
59   E(K x) : g(x) {}
62 struct foo : public bar {
63   K h;
64   E i;
65   foo(const K x, const E &y) : h(x), i(y) {}
68 struct A {
69   I *l;
70   foo *baz() const;
73 foo *A::baz() const
75   return new foo(l->u(), E(l->v()));
78 A x;
79 I i;
80 foo *f;
82 int main ()
84   x.l = &i;
85   f = x.baz();
86   if (f->h.c != f->i.g.c || f->h.d != f->i.g.d)
87     return 1;
88   return 0;