| 1 |
// PR c++/71092 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename _Default> struct A { using type = _Default; }; |
| 5 |
template <typename _Default, template <typename> class> |
| 6 |
using __detected_or = A<_Default>; |
| 7 |
template <typename _Default, template <typename> class _Op> |
| 8 |
using __detected_or_t = typename __detected_or<_Default, _Op>::type; |
| 9 |
template <typename _Tp> struct B { typedef _Tp value_type; }; |
| 10 |
struct C { |
| 11 |
template <typename _Tp> using __pointer = typename _Tp::pointer; |
| 12 |
}; |
| 13 |
template <typename _Alloc> struct J : C { |
| 14 |
using pointer = __detected_or_t<typename _Alloc::value_type *, __pointer>; |
| 15 |
}; |
| 16 |
template <typename _T1> void _Construct(_T1 *) { new _T1; } |
| 17 |
struct D { |
| 18 |
template <typename _ForwardIterator, typename _Size> |
| 19 |
static _ForwardIterator __uninit_default_n(_ForwardIterator p1, _Size) { |
| 20 |
_Construct(p1); |
| 21 |
return _ForwardIterator(); |
| 22 |
} |
| 23 |
}; |
| 24 |
template <typename _ForwardIterator, typename _Size> |
| 25 |
void __uninitialized_default_n(_ForwardIterator p1, _Size) { |
| 26 |
D::__uninit_default_n(p1, 0); |
| 27 |
} |
| 28 |
template <typename _ForwardIterator, typename _Size, typename _Tp> |
| 29 |
void __uninitialized_default_n_a(_ForwardIterator p1, _Size, _Tp) { |
| 30 |
__uninitialized_default_n(p1, 0); |
| 31 |
} |
| 32 |
template <typename> struct __shared_ptr { |
| 33 |
constexpr __shared_ptr() : _M_ptr(), _M_refcount() {} |
| 34 |
int _M_ptr; |
| 35 |
int _M_refcount; |
| 36 |
}; |
| 37 |
template <typename _Alloc> struct F { |
| 38 |
typedef _Alloc _Tp_alloc_type; |
| 39 |
struct G { |
| 40 |
typename J<_Tp_alloc_type>::pointer _M_start; |
| 41 |
G(_Tp_alloc_type); |
| 42 |
}; |
| 43 |
F(int, _Alloc p2) : _M_impl(p2) {} |
| 44 |
G _M_impl; |
| 45 |
}; |
| 46 |
template <typename _Tp, typename _Alloc = B<_Tp>> struct K : F<_Alloc> { |
| 47 |
typedef _Alloc allocator_type; |
| 48 |
K(int, allocator_type p2 = allocator_type()) : F<_Alloc>(0, p2) { |
| 49 |
__uninitialized_default_n_a(this->_M_impl._M_start, 0, 0); |
| 50 |
} |
| 51 |
}; |
| 52 |
struct H { |
| 53 |
H(); |
| 54 |
struct I { |
| 55 |
__shared_ptr<int> trigger[1]; |
| 56 |
}; |
| 57 |
__shared_ptr<int> resetTrigger_; |
| 58 |
K<I> states_; |
| 59 |
__shared_ptr<int> triggerManager_; |
| 60 |
}; |
| 61 |
__shared_ptr<int> a; |
| 62 |
H::H() : states_(0), triggerManager_(a) {} |