| 1 |
// PR c++/104008 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename...> struct conjunction; |
| 5 |
template <typename...> struct disjunction; |
| 6 |
template <typename, typename> struct is_same; |
| 7 |
template <bool> struct enable_if; |
| 8 |
template <bool _Cond> using enable_if_t = typename enable_if<_Cond>::type; |
| 9 |
struct B; |
| 10 |
struct __uniq_ptr_impl { |
| 11 |
struct _Ptr { |
| 12 |
using type = B *; |
| 13 |
}; |
| 14 |
using pointer = _Ptr::type; |
| 15 |
}; |
| 16 |
struct unique_ptr { |
| 17 |
using pointer = __uniq_ptr_impl::pointer; |
| 18 |
unique_ptr(pointer); |
| 19 |
}; |
| 20 |
template <typename T, typename... Ts> |
| 21 |
using IsOneOf = disjunction<is_same<T, Ts>...>; |
| 22 |
|
| 23 |
template <typename...> struct any_badge; |
| 24 |
|
| 25 |
struct badge { |
| 26 |
badge(any_badge<>); |
| 27 |
badge(); |
| 28 |
}; |
| 29 |
|
| 30 |
template <typename...> struct any_badge { |
| 31 |
template <typename... OtherHolders, |
| 32 |
enable_if_t<conjunction<IsOneOf<OtherHolders>...>::value>> |
| 33 |
any_badge(); |
| 34 |
}; |
| 35 |
|
| 36 |
template <typename, typename... _Args> unique_ptr make_unique(_Args... __args); |
| 37 |
|
| 38 |
struct B { |
| 39 |
B(badge); |
| 40 |
unique_ptr b_ = make_unique<B>(badge{}); |
| 41 |
}; |
| 42 |
|
| 43 |
template <typename, typename... _Args> unique_ptr make_unique(_Args... __args) { |
| 44 |
return new B(__args...); |
| 45 |
} |