OSDN Git Service

PR c++/31598
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / tree-ssa / pr27894.C
1 // PR c++/27894
2 // { dg-do compile }
3 // { dg-options "-O" }
4
5 class A;
6 struct B
7 {
8   B (unsigned long);
9   int b2 () const;
10   A *b1 () const;
11 };
12
13 enum { P = 0 };
14 enum O { Q = 75, };
15 class C;
16 struct D { A *d; };
17 struct E
18 {
19   B e1 (int) const;
20   A *e2 (const B &) const;
21   D e3[4096];
22 };
23
24 inline A *
25 E::e2 (const B & x) const
26 {
27   const D *w = &e3[x.b2 ()];
28   return (A *) w->d;
29 }
30
31 extern E *e;
32
33 inline A *
34 B::b1 () const
35 {
36   extern E *e;
37   return e->e2 (*this);
38 }
39
40 template <class T> struct F : public B
41 {
42   F (const B &);
43   T *b1 () const;
44 };
45
46 template < class T > inline T * F <T>::b1 () const
47 {
48   return (T *) B::b1 ();
49 };
50
51 typedef F <C> N;
52
53 class G {};
54 class H : public G {};
55 class I : public H {};
56 class J {};
57 class K {};
58 struct L
59 {
60   void l (J *, C *, int, const char *, O);
61 };
62 class M : public K, public I
63 {
64   void m (J &, int, const char *);
65   void m (J &, int, int, const char *, float);
66 };
67
68 void
69 M::m (J &x, int y, const char *z)
70 {
71   L *w = new L;
72   N v = e->e1 (y);
73   w->l (&x, v.b1 (), P, z, Q);
74 }
75
76 void
77 M::m (J &x, int y, int s, const char *z, float t)
78 {
79   L *w = new L;
80   N v = e->e1 (y);
81   w->l (&x, v.b1 (), s, z, (O) (int) ((t) ? (50 + 20 / (float) t) : 0));
82 }