summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.dg/pr55263.C
blob: 5ea863f1ae7a4de6439c87cbfd24d6539ed541ce (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
/* { dg-do compile } */
/* { dg-options "-c -O -fgcse-after-reload -fnon-call-exceptions" } */
template < typename _Tp > class new_allocator
{
public:
  typedef _Tp pointer;
  template < typename _Tp1 > struct rebind
  {
    typedef new_allocator < _Tp1 > other;
  };

};

template < typename > class allocator;

template < typename _Alloc > struct __alloc_traits
{
  typedef typename _Alloc::pointer pointer;
    template < typename _Tp > struct rebind
  {
    typedef typename _Alloc::template rebind < _Tp >::other other;
  };

};

template < typename _Tp, typename _Alloc > struct _Vector_base
{
  typedef
    typename
    __alloc_traits < _Alloc >::template rebind < _Tp >::other _Tp_alloc_type;
  typedef typename __alloc_traits < _Tp_alloc_type >::pointer pointer;
  struct _Vector_impl
  {
    pointer _M_start;
    pointer _M_end_of_storage;
  };

   ~_Vector_base ();
  _Vector_impl _M_impl;
};

template < typename _Tp, typename _Alloc = allocator < _Tp > >class vector:
_Vector_base < _Tp, _Alloc >
{
  typedef _Vector_base < _Tp, _Alloc > _Base;
public:
  typedef typename _Base::pointer pointer;
vector ():
  _Base ()
  {
    _M_erase_at_end (this->_M_impl._M_start);
  }
  void _M_erase_at_end (pointer)
  {
  }
};

template < typename T > class clear_alloc:
public new_allocator < T >
{
};

void
foo ()
{
  new vector < int, clear_alloc < int > >;
}

OpenPOWER on IntegriCloud