1 // { dg-do compile { target c++11 } }
3 namespace std { template <class T> T&& declval(); }
5 template<typename _Tp, typename... _Args>
6 class is_constructible_mini
9 typedef struct { char __arr[2]; } __two;
11 template<typename _Tp1, typename... _Args1>
12 static decltype(::new _Tp1(std::declval<_Args1>()...), __one())
15 template<typename, typename...>
16 static __two __test(...);
19 static const bool value = sizeof(__test<_Tp, _Args...>(0)) == 1;
23 template<typename _Tp>
24 class is_constructible_mini<_Tp>
27 typedef struct { char __arr[2]; } __two;
29 template<typename _Tp1>
30 static decltype(::new _Tp1, __one()) __test(int);
33 static __two __test(...);
36 static const bool value
37 = sizeof(__test<typename std::remove_cv<_Tp>::type>(0)) == 1;
48 static_assert( is_constructible_mini<A, int>::value, "");
49 static_assert( is_constructible_mini<A, A>::value, "");
50 static_assert( !is_constructible_mini<A, int, double>::value, "");
52 static_assert( !is_constructible_mini<A>::value, ""); // doesn't compile without the
53 // partial specialization
55 static_assert( is_constructible_mini<B>::value, "");
56 static_assert( is_constructible_mini<const B>::value, "");