Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -O1 %s
      2 // This used to crash under asan and valgrind.
      3 // PR12284
      4 
      5 template < typename _Tp > struct new_allocator
      6 {
      7   typedef _Tp *pointer;
      8   template < typename > struct rebind {
      9     typedef new_allocator other;
     10   };
     11 };
     12 template < typename _Tp > struct allocator:new_allocator < _Tp > {
     13 };
     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;
     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 };
     25 template < typename _Tp, typename _Alloc =
     26 allocator < _Tp > >struct vector:_Vector_base < _Tp, _Alloc > { };
     27 
     28 
     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;
     40 };
     41 class ZZZ:AAA < Data >, BBB { virtual ZZZ *ppp () ; };
     42 ZZZ * ZZZ::ppp () { return new ZZZ; }
     43