2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr64282.C
blob9696effc38d3ad8ab5956091e452e59d68a5a644
1 // { dg-do compile }
2 template <class _T1> struct A
4   _T1 first;
5 };
6 struct B
8   int operator!=(B);
9 };
10 template <typename _Tp> struct C
12   C (B);
13   _Tp operator*();
14   int operator!=(C);
16 template <typename _Tp> class D
18 public:
19   typedef C<_Tp> const_iterator;
20   const_iterator m_fn1 () const;
21   B m_fn2 ();
22   void m_fn3 ();
24 class F
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   }
50 public:
51   F () : _M_dataplus (m_fn4 ().m_fn6 (), 0) {}
53 class H
55   void m_fn7 (const F &, bool &);
56   void m_fn8 (const D<F> &, const F &, F &);
58 typedef A<int> CandPair;
59 class I
61 public:
62   virtual void m_fn9 (const F &, bool, D<CandPair> &);
64 class J : I
66 public:
67   void m_fn9 (const F &, bool, D<CandPair> &);
69 D<I *> c;
70 void
71 J::m_fn9 (const F &, bool, D<CandPair> &)
73   D<int> a;
74   for (B b; b != a.m_fn2 ();)
75     ;
77 inline void
78 fn2 (F p1, int, int, J *p4, D<CandPair>)
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);
86 void
87 H::m_fn7 (const F &, bool &)
89   A<F> f;
90   D<F> g;
91   F h;
92   m_fn8 (g, f.first, h);
94 void
95 H::m_fn8 (const D<F> &p1, const F &, F &)
97   F i;
98   p1.m_fn1 ();
99   D<CandPair> j;
100   fn2 (i, 0, 0, 0, j);