1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3 
4 namespace pr12262 {
5 
6 template<typename T, typename... Ts>
7 void abc1(int (*xxx)[sizeof ... (Ts) + 1]);
8 
9 void qq1 () {
10   abc1<int>(0);
11   abc1<int,double>(0);
12 }
13 
14 
15 template <unsigned N> class array {};
16 
17 
18 template<typename T, typename... Types>
19 array<sizeof...(Types)> make_array1(Types&&... args);
20 
21 void qq2 () {
22   array<1> arr = make_array1<int>(1);
23   array<3> arr2 = make_array1<int>(1,array<5>(),0.1);
24 }
25 
26 
27 template<typename T, typename... Types>
28 int make_array(array<sizeof...(Types)>&, Types... args);
29 
30 void qq3 () {
31   array<1> a1;
32   int aa1 = make_array<int>(a1,1);
33   array<2> a2;
34   int aa2 = make_array<int>(a2, 0L, "abc");
35 }
36 
37 
38 template<typename ... Ts>
39 struct AAA {
40   template<typename T, typename... Types>
41   static array<sizeof...(Types)> make_array(Types ... args);
42 };
43 
44 void qq4 () {
45   array<2> arr2 = AAA<int, int>::make_array<int>(1,2);
46 }
47 
48 }
49 
50 
51 namespace pr12439 {
52 
53 template<class... Members>
54 struct X {
55   template<int Idx>
56   using get_t = decltype(sizeof...(Members));
57 
58   template<int i>
59   get_t<i> get();
60 };
61 
62 template<class... Members>
63 template<int i>
64 X<Members...>::get_t<i> X<Members...>::get()
65 {
66   return 0;
67 }
68 
69 }
70 
71 
72 namespace pr13272 {
73 
74 template<bool B, class T = void>
75 struct enable_if { };
76 
77 template<class T> struct enable_if<true, T> {
78   typedef T type;
79 };
80 
81 class Exception {};
82 
83 template<class Ex, typename... Args>
84 void cxx_throw(typename enable_if<(sizeof...(Args) > 0), const char *>::type fmt, Args&&... args) {
85   return;
86 }
87 
88 void test() {
89   cxx_throw<Exception>("Youpi",1);
90 }
91 
92 }
93 
94 
95 namespace pr13817 {
96 
97 template <unsigned>
98 struct zod;
99 
100 template <>
101 struct zod<1> {};
102 
103 template <typename T, typename ... Ts>
104 zod<sizeof...(Ts)> make_zod(Ts ...) {
105   return zod<sizeof...(Ts)>();
106 }
107 
108 int main(int argc, char *argv[])
109 {
110   make_zod<int>(1);
111   return 0;
112 }
113 
114 }
115 
116 
117 namespace pr14273 {
118 
119 template<typename T, int i>
120 struct myType
121 { };
122 
123 template<typename T, typename... Args>
124 struct Counter
125 {
126   static const int count = 1 + Counter<Args...>::count;
127 };
128 
129 template<typename T>
130 struct Counter<T>
131 {
132   static const int count = 1;
133 };
134 
135 template<typename Arg, typename... Args>
136 myType<Arg, sizeof...(Args)>* make_array_with_type(const Args&... args)
137 {
138   return 0;
139 }
140 
141 void func(void)
142 {
143   make_array_with_type<char>(1,2,3);
144 }
145 
146 }
147 
148 
149 namespace pr15112
150 {
151   template<bool, typename _Tp = void>
152     struct enable_if
153     { };
154   template<typename _Tp>
155     struct enable_if<true,_Tp>
156     { typedef _Tp type; };
157 
158   typedef __typeof__(sizeof(int)) size_t;
159 
160   template <size_t n, typename T, typename... Args>
161   struct is_array_of { static const bool value = true; };
162 
163   struct cpu { using value_type = void; };
164 
165   template <size_t Order, typename T>
166   struct coords_alias { typedef T type; };
167 
168   template <size_t Order, typename MemoryTag>
169   using coords = typename coords_alias<Order, MemoryTag>::type;
170 
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);
175 
176   auto c1 = mkcoords<cpu>(0ul, 0ul, 0ul);
177 }
178 
179 
180 namespace pr12699 {
181 
182 template<bool B>
183 struct bool_constant
184 {
185   static const bool value = B;
186 };
187 
188 template<typename... A>
189 struct F
190 {
191   template<typename... B>
192     using SameSize = bool_constant<sizeof...(A) == sizeof...(B)>;
193 
194   template<typename... B, typename = SameSize<B...>>
195   F(B...) { }
196 };
197 
198 void func()
199 {
200   F<int> f1(3);
201 }
202 
203 }
204