brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 14f2356 Raw
43 lines · cpp
1// RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -O1 %s2// This used to crash under asan and valgrind.3// PR122844 5template < typename _Tp > struct new_allocator6{7  typedef _Tp *pointer;8  template < typename > struct rebind {9    typedef new_allocator other;10  };11};12template < typename _Tp > struct allocator:new_allocator < _Tp > {13};14template < 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;18  };19  _Vector_base () {20    foo((int *) this->_M_impl._M_end_of_storage);21  }22  void foo(int *);23  _Vector_impl _M_impl;24};25template < typename _Tp, typename _Alloc =26allocator < _Tp > >struct vector:_Vector_base < _Tp, _Alloc > { };27 28 29template < class T> struct HHH {};30struct DDD { int x_;};31struct Data;32struct X1;33struct CCC:DDD {   virtual void xxx (HHH < X1 >); };34template < class SSS > struct EEE:vector < HHH < SSS > > { };35template < class SSS, class = EEE < SSS > >class FFF { };36template < class SSS, class GGG = EEE < SSS > >class AAA:FFF <GGG> { };37class BBB:virtual CCC {38  void xxx (HHH < X1 >);39  vector < HHH < X1 > >aaa;40};41class ZZZ:AAA < Data >, BBB { virtual ZZZ *ppp () ; };42ZZZ * ZZZ::ppp () { return new ZZZ; }43