1 // PR c++/44967
2 // { dg-do compile { target c++11 } }
3 
4 template <typename T> T&& declval();
5 
6 template<typename T1, typename T2, typename... Args>
7 struct has_construct
8 {
9     typedef char one;
10     typedef struct {char _m[2]; } two;
11 
12     template<typename U1, typename U2, typename... Args2>
13     static decltype(declval<U1>().construct(declval<U2*>(), declval<Args2>()...), one()) test(int);
14     template<typename, typename, typename...>
15     static two test(...);
16 
17     static const bool value = sizeof(test<T1, T2, Args...>(0)) == 1;
18 };
19 
20 
21 struct A0
22 {};
23 
24 struct A1
25 {
26     void construct(int*, int);
27 };
28 
29 template<typename _Tp>
30 struct A2
31 {
32   template<typename _Tp1, typename... _Args>
constructA233   void construct(_Tp1*, _Args&&...) {}
34 };
35 
36 #define SA(X) static_assert(X,#X)
37 SA((!has_construct<A0, int, int>::value)); // ok
38 SA((has_construct<A1, int, int>::value)); // bang
39 SA((has_construct<A2<int>, int>::value)); // bang
40