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 };
_Construct(_T1 *)16 template <typename _T1> void _Construct(_T1 *) { new _T1; }
17 struct D {
18 template <typename _ForwardIterator, typename _Size>
__uninit_default_nD19 static _ForwardIterator __uninit_default_n(_ForwardIterator p1, _Size) {
20 _Construct(p1);
21 }
22 };
23 template <typename _ForwardIterator, typename _Size>
__uninitialized_default_n(_ForwardIterator p1,_Size)24 void __uninitialized_default_n(_ForwardIterator p1, _Size) {
25 D::__uninit_default_n(p1, 0);
26 }
27 template <typename _ForwardIterator, typename _Size, typename _Tp>
__uninitialized_default_n_a(_ForwardIterator p1,_Size,_Tp)28 void __uninitialized_default_n_a(_ForwardIterator p1, _Size, _Tp) {
29 __uninitialized_default_n(p1, 0);
30 }
31 template <typename> struct __shared_ptr {
__shared_ptr__shared_ptr32 constexpr __shared_ptr() : _M_ptr(), _M_refcount() {}
33 int _M_ptr;
34 int _M_refcount;
35 };
36 template <typename _Alloc> struct F {
37 typedef _Alloc _Tp_alloc_type;
38 struct G {
39 typename J<_Tp_alloc_type>::pointer _M_start;
40 G(_Tp_alloc_type);
41 };
FF42 F(int, _Alloc p2) : _M_impl(p2) {}
43 G _M_impl;
44 };
45 template <typename _Tp, typename _Alloc = B<_Tp>> struct K : F<_Alloc> {
46 typedef _Alloc allocator_type;
47 K(int, allocator_type p2 = allocator_type()) : F<_Alloc>(0, p2) {
48 __uninitialized_default_n_a(this->_M_impl._M_start, 0, 0);
49 }
50 };
51 struct H {
52 H();
53 struct I {
54 __shared_ptr<int> trigger[1];
55 };
56 __shared_ptr<int> resetTrigger_;
57 K<I> states_;
58 __shared_ptr<int> triggerManager_;
59 };
60 __shared_ptr<int> a;
H()61 H::H() : states_(0), triggerManager_(a) {}
62