| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
namespace std { template <class T> T&& declval(); } |
| 4 |
|
| 5 |
template<typename _Tp, typename... _Args> |
| 6 |
class is_constructible_mini |
| 7 |
{ |
| 8 |
typedef char __one; |
| 9 |
typedef struct { char __arr[2]; } __two; |
| 10 |
|
| 11 |
template<typename _Tp1, typename... _Args1> |
| 12 |
static decltype(::new _Tp1(std::declval<_Args1>()...), __one()) |
| 13 |
__test(int); |
| 14 |
|
| 15 |
template<typename, typename...> |
| 16 |
static __two __test(...); |
| 17 |
|
| 18 |
public: |
| 19 |
static const bool value = sizeof(__test<_Tp, _Args...>(0)) == 1; |
| 20 |
}; |
| 21 |
|
| 22 |
// int[](...) will work with P0960 and P1009. |
| 23 |
#if __cpp_aggregate_paren_init |
| 24 |
constexpr bool r = true; |
| 25 |
#else |
| 26 |
constexpr bool r = false; |
| 27 |
#endif |
| 28 |
static_assert( is_constructible_mini<int[], int>::value == r, ""); |
| 29 |
static_assert( !is_constructible_mini<void, int>::value, ""); |