1// { dg-do compile }
2template <class _T1> struct A
3{
4  _T1 first;
5};
6struct B
7{
8  int operator!=(B);
9};
10template <typename _Tp> struct C
11{
12  C (B);
13  _Tp operator*();
14  int operator!=(C);
15};
16template <typename _Tp> class D
17{
18public:
19  typedef C<_Tp> const_iterator;
20  const_iterator m_fn1 () const;
21  B m_fn2 ();
22  void m_fn3 ();
23};
24class F
25{
26  struct G
27  {
28    static G &
29    m_fn5 ()
30    {
31      void fn1 ();
32      return *reinterpret_cast<G *> (fn1);
33    }
34    int *
35    m_fn6 ()
36    {
37      return reinterpret_cast<int *> (this);
38    }
39  };
40  struct _Alloc_hider
41  {
42    _Alloc_hider (int *p1, int) : _M_p (p1) {}
43    int *_M_p;
44  } _M_dataplus;
45  G &
46  m_fn4 ()
47  {
48    return G::m_fn5 ();
49  }
50public:
51  F () : _M_dataplus (m_fn4 ().m_fn6 (), 0) {}
52};
53class H
54{
55  void m_fn7 (const F &, bool &);
56  bool m_fn8 (const D<F> &, const F &, F &);
57};
58typedef A<int> CandPair;
59class I
60{
61public:
62  virtual void m_fn9 (const F &, bool, D<CandPair> &);
63};
64class J : I
65{
66public:
67  void m_fn9 (const F &, bool, D<CandPair> &);
68};
69D<I *> c;
70void
71J::m_fn9 (const F &, bool, D<CandPair> &)
72{
73  D<int> a;
74  for (B b; b != a.m_fn2 ();)
75    ;
76}
77inline void
78fn2 (F p1, int, int, J *p4, D<CandPair>)
79{
80  D<CandPair> d;
81  d.m_fn3 ();
82  p4->m_fn9 (p1, 0, d);
83  for (D<I *>::const_iterator e = c.m_fn1 (); e != c.m_fn2 ();)
84    (*e)->m_fn9 (p1, 0, d);
85}
86void
87H::m_fn7 (const F &, bool &)
88{
89  A<F> f;
90  D<F> g;
91  F h;
92  m_fn8 (g, f.first, h);
93}
94bool
95H::m_fn8 (const D<F> &p1, const F &, F &)
96{
97  F i;
98  p1.m_fn1 ();
99  D<CandPair> j;
100  fn2 (i, 0, 0, 0, j);
101}
102