1// { dg-do run { target i?86-*-* x86_64-*-* } } 2// { dg-require-effective-target ilp32 } 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))|\[Bb\]ad fixup at .DATA.:" "PIC unsupported" { xfail *-*-netware* } 0 } 5class G {}; 6 7struct N { 8 N *a; 9}; 10 11struct 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); } 16}; 17 18struct H; 19 20struct J { 21 N *c; 22 H *d; 23 J(N *x, H *y) : c(x), d(y) {} 24}; 25 26struct 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) {} 31}; 32 33struct H { 34 V e; 35 int f; 36 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); } 45}; 46 47struct I { 48 H d; 49 J u() { return d.u(); } 50 J v() { return d.v(); } 51}; 52 53struct bar { 54 virtual ~bar() {} 55}; 56 57struct E { 58 K g; 59 E(K x) : g(x) {} 60}; 61 62struct foo : public bar { 63 K h; 64 E i; 65 foo(const K x, const E &y) : h(x), i(y) {} 66}; 67 68struct A { 69 I *l; 70 foo *baz() const; 71}; 72 73foo *A::baz() const 74{ 75 return new foo(l->u(), E(l->v())); 76} 77 78A x; 79I i; 80foo *f; 81 82int main () 83{ 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; 89} 90