1 // { dg-do compile { target c++11 } }
3 template<typename _Default, typename _AlwaysVoid, template<typename...> class _Op, typename... _Args>
6 using type = _Op<_Args...>;
8 template<typename _Default, template<typename...> class _Op, typename... _Args>
9 using __detected_or = __detector<_Default, void, _Op, _Args...>;
10 template<typename _Default, template<typename...> class _Op, typename... _Args>
11 using __detected_or_t = typename __detected_or<_Default, _Op, _Args...>::type;
12 template<typename _Alloc>
13 struct allocator_traits {
14 template<typename _Tp>
15 using __pointer = typename _Tp::pointer;
16 using pointer = __detected_or_t<typename _Alloc::value_type*, __pointer, _Alloc>;
18 template<typename _Storage_policy>
19 struct _Pointer_adapter {
20 typedef typename _Storage_policy::element_type element_type;
21 typedef element_type& reference;
23 template<typename _Tp>
24 inline _Tp* addressof(_Tp& __r); // { dg-warning "used but never defined" }
25 template<typename _Alloc>
26 struct __allocated_ptr {
29 using pointer = typename allocator_traits<_Alloc>::pointer;
30 typename _Pointer_adapter<pointer>::reference __r = *(int*)0;
34 template<typename _Tp>
35 struct _Std_pointer_impl {
36 typedef _Tp element_type;
39 struct CustomPointerAlloc {
40 typedef Tp value_type;
41 typedef _Pointer_adapter<_Std_pointer_impl<Tp>> pointer;
43 __allocated_ptr<CustomPointerAlloc<int>> __guard_ptr;