| 1 |
// PR c++/67161 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// { dg-additional-options "-Wno-return-type" } |
| 4 |
|
| 5 |
template <typename _Tp> struct integral_constant { |
| 6 |
static constexpr _Tp value = 0; |
| 7 |
}; |
| 8 |
template <bool, typename, typename> struct conditional; |
| 9 |
template <typename...> struct __or_; |
| 10 |
template <typename _B1, typename _B2> |
| 11 |
struct __or_<_B1, _B2> : conditional<1, _B1, _B2>::type {}; |
| 12 |
template <typename...> struct __and_; |
| 13 |
template <typename> struct __not_ : integral_constant<bool> {}; |
| 14 |
template <typename> struct __is_void_helper : integral_constant<bool> {}; |
| 15 |
template <typename> struct is_void : __is_void_helper<int> {}; |
| 16 |
template <bool, typename _Iftrue, typename> struct conditional { |
| 17 |
typedef _Iftrue type; |
| 18 |
}; |
| 19 |
template <bool _Cond, typename _Iftrue, typename _Iffalse> |
| 20 |
using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type; |
| 21 |
template <typename...> using common_type_t = int; |
| 22 |
template <typename, int> struct array {}; |
| 23 |
template <typename _Tp> constexpr int is_void_v = is_void<_Tp>::value; |
| 24 |
template <typename _Dest = void, typename... _Types> |
| 25 |
constexpr auto make_array() |
| 26 |
-> array<conditional_t<is_void_v<_Dest>, common_type_t<>, _Dest>, |
| 27 |
sizeof...(_Types)> { |
| 28 |
static_assert(__or_<__not_<is_void<_Dest>>, __and_<>>::value, ""); // { dg-error "static assert" } |
| 29 |
throw 1; |
| 30 |
} |
| 31 |
auto d = make_array(); |