[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / thunk-use-after-free.cpp
blob14f2356ea456b99a95b84dfbb0c0c3e75b0330a4
1 // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -O1 %s
2 // This used to crash under asan and valgrind.
3 // PR12284
5 template < typename _Tp > struct new_allocator
7 typedef _Tp *pointer;
8 template < typename > struct rebind {
9 typedef new_allocator other;
12 template < typename _Tp > struct allocator:new_allocator < _Tp > {
14 template < typename _Tp, typename _Alloc > struct _Vector_base {
15 typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
16 struct _Vector_impl {
17 typename _Tp_alloc_type::pointer _M_end_of_storage;
19 _Vector_base () {
20 foo((int *) this->_M_impl._M_end_of_storage);
22 void foo(int *);
23 _Vector_impl _M_impl;
25 template < typename _Tp, typename _Alloc =
26 allocator < _Tp > >struct vector:_Vector_base < _Tp, _Alloc > { };
29 template < class T> struct HHH {};
30 struct DDD { int x_;};
31 struct Data;
32 struct X1;
33 struct CCC:DDD { virtual void xxx (HHH < X1 >); };
34 template < class SSS > struct EEE:vector < HHH < SSS > > { };
35 template < class SSS, class = EEE < SSS > >class FFF { };
36 template < class SSS, class GGG = EEE < SSS > >class AAA:FFF <GGG> { };
37 class BBB:virtual CCC {
38 void xxx (HHH < X1 >);
39 vector < HHH < X1 > >aaa;
41 class ZZZ:AAA < Data >, BBB { virtual ZZZ *ppp () ; };
42 ZZZ * ZZZ::ppp () { return new ZZZ; }