blob: 72d30eba26e9481e3cdf402da5837525229ac164 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-require-effective-target ilp32 }
// { dg-require-effective-target fpic }
// { dg-options "-mtune=i686 -O2 -fpic" }
class G {};
struct N {
N *a;
};
struct V {
typedef N *W;
W *m, *n;
int s() const { return int(n - m); }
const W &operator[](int x) const { return *(m + x); }
};
struct H;
struct J {
N *c;
H *d;
J(N *x, H *y) : c(x), d(y) {}
};
struct K {
const N *c;
const H *d;
K(const N *x, const H *y) : c(x), d(y) {}
K(const J &x) : c(x.c), d(x.d) {}
};
struct H {
V e;
int f;
J u()
{
for (int x = 0; x < e.s(); ++x)
if (e[x])
return J(e[x], this);
return v();
}
J v() { return J((N*)64, this); }
};
struct I {
H d;
J u() { return d.u(); }
J v() { return d.v(); }
};
struct bar {
virtual ~bar() {}
};
struct E {
K g;
E(K x) : g(x) {}
};
struct foo : public bar {
K h;
E i;
foo(const K x, const E &y) : h(x), i(y) {}
};
struct A {
I *l;
foo *baz() const;
};
foo *A::baz() const
{
return new foo(l->u(), E(l->v()));
}
A x;
I i;
foo *f;
int main ()
{
x.l = &i;
f = x.baz();
if (f->h.c != f->i.g.c || f->h.d != f->i.g.d)
return 1;
return 0;
}
|