1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
3 // expected-no-diagnostics
7 template<typename T
, typename
... Ts
>
8 void abc1(int (*xxx
)[sizeof ... (Ts
) + 1]);
16 template <unsigned N
> class array
{};
19 template<typename T
, typename
... Types
>
20 array
<sizeof...(Types
)> make_array1(Types
&&... args
);
23 array
<1> arr
= make_array1
<int>(1);
24 array
<3> arr2
= make_array1
<int>(1,array
<5>(),0.1);
28 template<typename T
, typename
... Types
>
29 int make_array(array
<sizeof...(Types
)>&, Types
... args
);
33 int aa1
= make_array
<int>(a1
,1);
35 int aa2
= make_array
<int>(a2
, 0L, "abc");
39 template<typename
... Ts
>
41 template<typename T
, typename
... Types
>
42 static array
<sizeof...(Types
)> make_array(Types
... args
);
46 array
<2> arr2
= AAA
<int, int>::make_array
<int>(1,2);
54 template<class... Members
>
57 using get_t
= decltype(sizeof...(Members
));
63 template<class... Members
>
65 typename X
<Members
...>::template get_t
<i
> X
<Members
...>::get()
75 template<bool B
, class T
= void>
78 template<class T
> struct enable_if
<true, T
> {
84 template<class Ex
, typename
... Args
>
85 void cxx_throw(typename enable_if
<(sizeof...(Args
) > 0), const char *>::type fmt
, Args
&&... args
) {
90 cxx_throw
<Exception
>("Youpi",1);
104 template <typename T
, typename
... Ts
>
105 zod
<sizeof...(Ts
)> make_zod(Ts
...) {
106 return zod
<sizeof...(Ts
)>();
109 int main(int argc
, char *argv
[])
120 template<typename T
, int i
>
124 template<typename T
, typename
... Args
>
127 static const int count
= 1 + Counter
<Args
...>::count
;
133 static const int count
= 1;
136 template<typename Arg
, typename
... Args
>
137 myType
<Arg
, sizeof...(Args
)>* make_array_with_type(const Args
&... args
)
144 make_array_with_type
<char>(1,2,3);
152 template<bool, typename _Tp
= void>
155 template<typename _Tp
>
156 struct enable_if
<true,_Tp
>
157 { typedef _Tp type
; };
159 typedef __typeof__(sizeof(int)) size_t;
161 template <size_t n
, typename T
, typename
... Args
>
162 struct is_array_of
{ static const bool value
= true; };
164 struct cpu
{ using value_type
= void; };
166 template <size_t Order
, typename T
>
167 struct coords_alias
{ typedef T type
; };
169 template <size_t Order
, typename MemoryTag
>
170 using coords
= typename coords_alias
<Order
, MemoryTag
>::type
;
172 template <typename MemTag
, typename
... Args
>
173 typename enable_if
<is_array_of
<sizeof...(Args
), size_t, Args
...>::value
,
174 coords
<sizeof...(Args
), MemTag
>>::type
175 mkcoords(Args
... args
);
177 auto c1
= mkcoords
<cpu
>(0ul, 0ul, 0ul);
186 static const bool value
= B
;
189 template<typename
... A
>
192 template<typename
... B
>
193 using SameSize
= bool_constant
<sizeof...(A
) == sizeof...(B
)>;
195 template<typename
... B
, typename
= SameSize
<B
...>>
206 #if __cplusplus >= 202002L
209 template <class E
> struct Bar
;
214 template <int> struct Foo
{};
216 // Bar<Ts> doesn't have to be of a complete type.
217 template <class... Ts
>
218 auto func() requires
requires(Bar
<Ts
> ...init_lists
) {
219 sizeof...(init_lists
) > 0;
222 void f() { func
<int>(); }
224 } // namespace GH81436