1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // expected-no-diagnostics
6 template<typename T
, typename
... Ts
>
7 void abc1(int (*xxx
)[sizeof ... (Ts
) + 1]);
15 template <unsigned N
> class array
{};
18 template<typename T
, typename
... Types
>
19 array
<sizeof...(Types
)> make_array1(Types
&&... args
);
22 array
<1> arr
= make_array1
<int>(1);
23 array
<3> arr2
= make_array1
<int>(1,array
<5>(),0.1);
27 template<typename T
, typename
... Types
>
28 int make_array(array
<sizeof...(Types
)>&, Types
... args
);
32 int aa1
= make_array
<int>(a1
,1);
34 int aa2
= make_array
<int>(a2
, 0L, "abc");
38 template<typename
... Ts
>
40 template<typename T
, typename
... Types
>
41 static array
<sizeof...(Types
)> make_array(Types
... args
);
45 array
<2> arr2
= AAA
<int, int>::make_array
<int>(1,2);
53 template<class... Members
>
56 using get_t
= decltype(sizeof...(Members
));
62 template<class... Members
>
64 typename X
<Members
...>::template get_t
<i
> X
<Members
...>::get()
74 template<bool B
, class T
= void>
77 template<class T
> struct enable_if
<true, T
> {
83 template<class Ex
, typename
... Args
>
84 void cxx_throw(typename enable_if
<(sizeof...(Args
) > 0), const char *>::type fmt
, Args
&&... args
) {
89 cxx_throw
<Exception
>("Youpi",1);
103 template <typename T
, typename
... Ts
>
104 zod
<sizeof...(Ts
)> make_zod(Ts
...) {
105 return zod
<sizeof...(Ts
)>();
108 int main(int argc
, char *argv
[])
119 template<typename T
, int i
>
123 template<typename T
, typename
... Args
>
126 static const int count
= 1 + Counter
<Args
...>::count
;
132 static const int count
= 1;
135 template<typename Arg
, typename
... Args
>
136 myType
<Arg
, sizeof...(Args
)>* make_array_with_type(const Args
&... args
)
143 make_array_with_type
<char>(1,2,3);
151 template<bool, typename _Tp
= void>
154 template<typename _Tp
>
155 struct enable_if
<true,_Tp
>
156 { typedef _Tp type
; };
158 typedef __typeof__(sizeof(int)) size_t;
160 template <size_t n
, typename T
, typename
... Args
>
161 struct is_array_of
{ static const bool value
= true; };
163 struct cpu
{ using value_type
= void; };
165 template <size_t Order
, typename T
>
166 struct coords_alias
{ typedef T type
; };
168 template <size_t Order
, typename MemoryTag
>
169 using coords
= typename coords_alias
<Order
, MemoryTag
>::type
;
171 template <typename MemTag
, typename
... Args
>
172 typename enable_if
<is_array_of
<sizeof...(Args
), size_t, Args
...>::value
,
173 coords
<sizeof...(Args
), MemTag
>>::type
174 mkcoords(Args
... args
);
176 auto c1
= mkcoords
<cpu
>(0ul, 0ul, 0ul);
185 static const bool value
= B
;
188 template<typename
... A
>
191 template<typename
... B
>
192 using SameSize
= bool_constant
<sizeof...(A
) == sizeof...(B
)>;
194 template<typename
... B
, typename
= SameSize
<B
...>>