| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-c -O3" } */ |
| 3 |
template<typename _Tp> struct A { |
| 4 |
typedef _Tp *pointer; |
| 5 |
typedef _Tp& reference; |
| 6 |
typedef _Tp& const_reference; |
| 7 |
template<typename>struct rebind |
| 8 |
{ |
| 9 |
typedef A other; |
| 10 |
}; |
| 11 |
}; |
| 12 |
|
| 13 |
template<typename _Alloc>struct __alloc_traits |
| 14 |
{ |
| 15 |
typedef typename _Alloc::pointer pointer; |
| 16 |
typedef typename _Alloc::reference reference; |
| 17 |
typedef typename _Alloc::const_reference const_reference; |
| 18 |
template<typename _Tp>struct rebind |
| 19 |
{ |
| 20 |
typedef typename _Alloc::template rebind<_Tp>::other other; |
| 21 |
}; |
| 22 |
}; |
| 23 |
template<typename _Tp, typename _Alloc>struct B |
| 24 |
{ |
| 25 |
typedef typename __alloc_traits<_Alloc>::template rebind< |
| 26 |
_Tp>::other _Tp_alloc_type; |
| 27 |
typedef typename __alloc_traits<_Tp_alloc_type>::pointer pointer; |
| 28 |
struct F |
| 29 |
{ |
| 30 |
pointer _M_start; |
| 31 |
}; |
| 32 |
F _M_impl; |
| 33 |
}; |
| 34 |
template<typename _Tp, typename _Alloc = A<_Tp> >class vec : B<_Tp, _Alloc>{ |
| 35 |
typedef B<_Tp, _Alloc> _Base; |
| 36 |
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; |
| 37 |
typedef __alloc_traits<_Tp_alloc_type> _Alloc_traits; |
| 38 |
|
| 39 |
public: |
| 40 |
typedef _Tp value_type; |
| 41 |
typedef typename _Alloc_traits::reference reference; |
| 42 |
typedef typename _Alloc_traits::const_reference const_reference; |
| 43 |
reference operator[](int p1) |
| 44 |
{ |
| 45 |
return *(this->_M_impl._M_start + p1); |
| 46 |
} |
| 47 |
|
| 48 |
const_reference operator[](long) const; |
| 49 |
}; |
| 50 |
|
| 51 |
int a[17]; |
| 52 |
class C { |
| 53 |
vec<int> m_value; |
| 54 |
void opModDivGuts(const C&); |
| 55 |
int mostSetBitP1() const; |
| 56 |
}; |
| 57 |
void C::opModDivGuts(const C& p1) |
| 58 |
{ |
| 59 |
int b = p1.mostSetBitP1(), c = b + 1; |
| 60 |
int d[16]; |
| 61 |
|
| 62 |
for (int i = c; i; i--) |
| 63 |
a[i] = p1.m_value[i] << b; |
| 64 |
|
| 65 |
for (int i = 0; i < c; i++) |
| 66 |
m_value[i] = d[i] >> b << -b; |
| 67 |
} |