aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/debug-info-use-after-free.cpp
blob: 852e14895618b865d2a0cd21e405fbba755c7c9f (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
// RUN: %clang_cc1 -g -emit-llvm-only %s
// Check that we don't crash.
// PR12305, PR12315

# 1 "a.h"  3
template < typename T1 > struct Types1
{
  typedef T1 Head;
};
template < typename > struct Types;
template < template < typename > class Tmpl > struct TemplateSel
{
  template < typename T > struct Bind
  {
    typedef Tmpl < T > type;
  };
};
template < typename > struct NoneT;
template < template < typename > class T1, template < typename > class > struct Templates2
{
  typedef TemplateSel < T1 > Head;
};
template < template < typename > class, template < typename > class =
  NoneT, template < typename > class = NoneT, template < typename > class =
  NoneT > struct Templates;
template < template < typename > class T1,
  template < typename > class T2 > struct Templates <T1, T2 >
{
  typedef Templates2 < T1, T2 > type;
};
template < typename T > struct TypeList
{
  typedef Types1 < T > type;
};
template < template < typename > class, class TestSel,
  typename Types > class TypeParameterizedTest
{
public:static bool Register ()
  {
    typedef typename Types::Head Type;
    typename TestSel::template Bind < Type >::type TestClass;
}};

template < template < typename > class Fixture, typename Tests,
  typename Types > class TypeParameterizedTestCase
{
public:static bool Register (char *, char *, int *)
  {
    typedef typename Tests::Head Head;
    TypeParameterizedTest < Fixture, Head, Types >::Register;
}};

template < typename > class TypedTestP1
{
};

namespace gtest_case_TypedTestP1_
{
  template < typename gtest_TypeParam_ > class A:TypedTestP1 <
    gtest_TypeParam_ >
  {
  };
template < typename gtest_TypeParam_ > class B:TypedTestP1 <
    gtest_TypeParam_ >
  {
  };
  typedef Templates < A >::type gtest_AllTests_;
}

template < typename > class TypedTestP2
{
};

namespace gtest_case_TypedTestP2_
{
  template < typename gtest_TypeParam_ > class A:TypedTestP2 <
    gtest_TypeParam_ >
  {
  };
  typedef Templates < A >::type gtest_AllTests_;
}

bool gtest_Int_TypedTestP1 =
  TypeParameterizedTestCase < TypedTestP1,
  gtest_case_TypedTestP1_::gtest_AllTests_,
  TypeList < int >::type >::Register ("Int", "TypedTestP1", 0);
bool gtest_Int_TypedTestP2 =
  TypeParameterizedTestCase < TypedTestP2,
  gtest_case_TypedTestP2_::gtest_AllTests_,
  TypeList < Types < int > >::type >::Register ("Int", "TypedTestP2", 0);

template < typename _Tp > struct new_allocator
{
  typedef _Tp *pointer;
  template < typename > struct rebind {
    typedef new_allocator other;
  };
};
template < typename _Tp > struct allocator:new_allocator < _Tp > {
};
template < typename _Tp, typename _Alloc > struct _Vector_base {
  typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
  struct _Vector_impl {
    typename _Tp_alloc_type::pointer _M_end_of_storage;
  };
  _Vector_base () {
    foo((int *) this->_M_impl._M_end_of_storage);
  }
  void foo(int *);
  _Vector_impl _M_impl;
};
template < typename _Tp, typename _Alloc =
allocator < _Tp > >struct vector:_Vector_base < _Tp, _Alloc > { };


template < class T> struct HHH {};
struct DDD { int x_;};
struct Data;
struct X1;
struct CCC:DDD {   virtual void xxx (HHH < X1 >); };
template < class SSS > struct EEE:vector < HHH < SSS > > { };
template < class SSS, class = EEE < SSS > >class FFF { };
template < class SSS, class GGG = EEE < SSS > >class AAA:FFF <GGG> { };
class BBB:virtual CCC {
  void xxx (HHH < X1 >);
  vector < HHH < X1 > >aaa;
};
class ZZZ:AAA < Data >, BBB { virtual ZZZ *ppp () ; };
ZZZ * ZZZ::ppp () { return new ZZZ; }

namespace std
{
  template < class, class > struct pair;
}
namespace __gnu_cxx {
template < typename > class new_allocator;
}
namespace std {
template < typename _Tp > class allocator:__gnu_cxx::new_allocator < _Tp > {
};
template < typename, typename > struct _Vector_base {
};
template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:_Vector_base < _Tp,
  _Alloc
        > {
        };
}

namespace
std {
  template <
      typename,
      typename > struct unary_function;
  template <
      typename,
      typename,
      typename > struct binary_function;
  template <
      typename
      _Tp > struct equal_to:
        binary_function <
        _Tp,
        _Tp,
        bool > {
        };
  template <
      typename
      _Pair > struct _Select1st:
        unary_function <
        _Pair,
        typename
        _Pair::first_type > {
        };
}
# 1 "f.h"  3
using
std::pair;
namespace
__gnu_cxx {
  template <
      class > struct hash;
  template <
      class,
      class,
      class,
      class,
      class
          _EqualKey,
      class >
          class
          hashtable {
           public:
            typedef _EqualKey
                key_equal;
            typedef void key_type;
          };
  using
      std::equal_to;
  using
      std::allocator;
  using
      std::_Select1st;
  template < class _Key, class _Tp, class _HashFn =
      hash < _Key >, class _EqualKey = equal_to < _Key >, class _Alloc =
      allocator < _Tp > >class hash_map {
        typedef
            hashtable <
            pair <
            _Key,
        _Tp >,
        _Key,
        _HashFn,
        _Select1st <
            pair <
            _Key,
        _Tp > >,
        _EqualKey,
        _Alloc >
            _Ht;
       public:
        typedef typename _Ht::key_type key_type;
        typedef typename
            _Ht::key_equal
            key_equal;
      };
}
using
__gnu_cxx::hash_map;
class
C2;
template < class > class scoped_ptr {
};
namespace {
class
    AAA {
      virtual ~
          AAA () {
          }};
}
template < typename > class EEE;
template < typename CCC, typename =
typename CCC::key_equal, typename =
EEE < CCC > >class III {
};
namespace
util {
  class
      EEE {
      };
}
namespace {
class
    C1:
      util::EEE {
       public:
        class
            C3:
              AAA {
                struct FFF;
                typedef
                    III <
                    hash_map <
                    C2,
                    FFF > >
                        GGG;
                GGG
                    aaa;
                friend
                    C1;
              };
        void
            HHH (C3::GGG &);
      };
}
namespace
n1 {
  class
      Test {
      };
  template <
      typename >
      class
      C7 {
      };
  class
      C4:
        n1::Test {
          vector <
              C1::C3 * >
              a1;
        };
  enum C5 { };
  class
      C6:
        C4,
        n1::C7 <
        C5 > {
        };
  class
      C8:
        C6 {
        };
  class
      C9:
        C8 {
          void
              TestBody ();
        };
  void
      C9::TestBody () {
        scoped_ptr < C1::C3 > context;
      }
}