* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / sfinae2.C
blob6f617b289bdc83222eeea4589a3b25973518df3d
1 // PR c++/44967
2 // { dg-do compile { target c++11 } }
4 template <typename T> T&& declval();
6 template<typename T1, typename T2, typename... Args>
7 struct has_construct
9     typedef char one;
10     typedef struct {char _m[2]; } two;
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(...);
17     static const bool value = sizeof(test<T1, T2, Args...>(0)) == 1;
21 struct A0
22 {};
24 struct A1
26     void construct(int*, int);
29 template<typename _Tp>
30 struct A2
32   template<typename _Tp1, typename... _Args>
33   void construct(_Tp1*, _Args&&...) {}
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