1 alias TypeTuple(T...) = T;
2 
3 class A { }
4 class B : A { }
5 class C : B { }
6 
7 /***************************************/
8 
Foo(int a,int b,int c)9 template Foo(int a, int b, int c)
10 {
11     const int Foo = 1;
12 }
13 
Foo(A...)14 template Foo(A...)
15 {
16     const int Foo = 2;
17 }
18 
test1()19 void test1()
20 {
21     int y = Foo!(1,2,3);
22     assert(y == 1);
23 
24     y = Foo!(1,2);
25     assert(y == 2);
26 
27     y = Foo!(1,2,3,4);
28     assert(y == 2);
29 }
30 
31 /***************************************/
32 
Foo2(int a,int b,int c)33 template Foo2(int a, int b, int c)
34 {
35     const int Foo2 = 1;
36 }
37 
Foo2(int a,int b,int c,A...)38 template Foo2(int a, int b, int c, A...)
39 {
40     const int Foo2 = 2;
41 }
42 
test2()43 void test2()
44 {
45     int y = Foo2!(1,2,3);
46     assert(y == 1);
47 
48     y = Foo2!(1,2,3,4);
49     assert(y == 2);
50 }
51 
52 /***************************************/
53 
bar3(int x,int y)54 void bar3(int x, int y)
55 {
56     assert(x == 2);
57     assert(y == 3);
58 }
59 
Foo3(T,A...)60 template Foo3(T, A...)
61 {
62     int Foo3(T t, A a)
63     {
64         assert(A.length == 2);
65         assert(a.length == 2);
66         bar3(a);
67         assert([a] == [2, 3]);
68         assert([cast(double)a] == [2.0, 3.0]);
69         assert(a[0] == 2);
70         assert(a[1] == 3);
71         assert(a[$ - 2] == 2);
72         assert(a[$ - 1] == 3);
73         static if (1 || a[6])
74             assert(1);
75         assert([a[]] == [2, 3]);
76         assert([a[0 .. $]] == [2, 3]);
77         assert([a[0 .. $ - 1]] == [2]);
78         return 3;
79     }
80 }
81 
test3()82 void test3()
83 {
84     int y = Foo3(1,2,3);
85     assert(y == 3);
86 }
87 
88 /***************************************/
89 
90 
foo4(A...)91 void foo4(A...)()
92 {
93     int[] ai;
94     int[] aa;
95 
96     aa = null;
97     foreach (a; A)
98     {
99         aa ~= a;
100     }
101     assert(aa == [7,4,9]);
102 
103     aa = null;
104     foreach (int a; A)
105     {
106         aa ~= a;
107     }
108     assert(aa == [7,4,9]);
109 
110     ai = null;
111     aa = null;
112     foreach (int i, a; A)
113     {
114         ai ~= i;
115         aa ~= a;
116     }
117     assert(ai == [0,1,2]);
118     assert(aa == [7,4,9]);
119 
120     ai = null;
121     aa = null;
122     foreach_reverse (uint i, a; A)
123     {
124         ai ~= i;
125         aa ~= a;
126     }
127     assert(ai == [2,1,0]);
128     assert(aa == [9,4,7]);
129 
130     ai = null;
131     aa = null;
132     foreach_reverse (i, a; A)
133     {
134         ai ~= i;
135         aa ~= a;
136     }
137     assert(ai == [2,1,0]);
138     assert(aa == [9,4,7]);
139 
140     ai = null;
141     aa = null;
142     foreach (int i, a; A)
143     {
144         ai ~= i;
145         aa ~= a;
146         if (i == 1)
147             break;
148         continue;
149     }
150     assert(ai == [0,1]);
151     assert(aa == [7,4]);
152 }
153 
test4()154 void test4()
155 {
156     foo4!(7,4,9)();
157 }
158 
159 /***************************************/
160 
161 int a12(TypeTuple!(int, int) t)
162 {
163     return t[0] + t[1];
164 }
165 
166 int b12(TypeTuple!(TypeTuple!(int), TypeTuple!(int)) t)
167 {
168     return t[0] + t[1];
169 }
170 
171 int c12(TypeTuple!(TypeTuple!(int), TypeTuple!(TypeTuple!(), int), TypeTuple!()) t)
172 {
173     return t[0] + t[1];
174 }
175 
test12()176 void test12()
177 {
178     assert(a12(1, 2) == 3);
179     assert(b12(1, 2) == 3);
180     assert(c12(1, 2) == 3);
181 }
182 
183 /***************************************/
184 
185 
186 int plus13(TypeTuple!(int, long, float)[0 .. 2] t)
187 {
188     typeof(t)[0] e;
189     assert(typeid(typeof(e)) == typeid(int));
190     typeof(t)[1] f;
191     assert(typeid(typeof(f)) == typeid(long));
192     return t[0] + cast(int)t[1];
193 }
194 
test13()195 void test13()
196 {
197     assert(plus13(5, 6) == 11);
198 }
199 
200 /***************************************/
201 
202 int plus14(TypeTuple!(int, long, float)[0 .. $ - 1] t)
203 {
204     typeof(t)[$ - 2] e;
205     assert(typeid(typeof(e)) == typeid(int));
206     typeof(t)[1] f;
207     assert(typeid(typeof(f)) == typeid(long));
208     return t[0] + cast(int)t[1];
209 }
210 
test14()211 void test14()
212 {
213     assert(plus14(5, 6) == 11);
214 }
215 
216 /***************************************/
217 
returnAndArgs(T,U...)218 void returnAndArgs(T, U...) (T delegate(U) dg)
219 {
220     static if (U.length == 0)
221         assert(dg() == 0);
222     else static if (U.length == 1)
223         assert(dg(false) == 1);
224     else
225         assert(dg(false, 63L) == 2);
226 }
227 
test24()228 void test24()
229 {
230     returnAndArgs(delegate int(){ return 0; });
231     returnAndArgs(delegate int(bool b){ return 1; });
232     returnAndArgs(delegate int(bool b, long c){ return 2; });
233 }
234 
235 /***************************************/
236 
test28()237 void test28()
238 {
239     alias TypeTuple!(int, long, double) TL;
240 
241     foreach (int i, T; TL)
242     {
243         switch (i)
244         {
245             case 0: assert(is(T == int));    break;
246             case 1: assert(is(T == long));   break;
247             case 2: assert(is(T == double)); break;
248             default:assert(0);
249         }
250     }
251 }
252 
253 /***************************************/
254 
g32(alias B)255 template g32(alias B)
256 {
257     int g32 = 2;
258 }
259 
f32(A...)260 int f32(A...)(A a)
261 {
262     return g32!(a);
263 }
264 
test32()265 void test32()
266 {
267     assert(f32(4) == 2);
268 }
269 
270 /***************************************/
271 
272 struct S34
273 {
274     int x;
275     long y;
276     double z;
277 }
278 
foo34(int x,long y,double z)279 void foo34(int x, long y, double z)
280 {
281     assert(x == 3);
282     assert(y == 8);
283     assert(z == 6.8);
284 }
285 
test34()286 void test34()
287 {
288     S34 s;
289 
290     s.x = 3;
291     s.y = 8;
292     s.z = 6.8;
293     foo34(s.tupleof);
294 }
295 
296 /***************************************/
297 
298 alias TypeTuple!(int, long, double) TL35;
299 
300 struct S35
301 {
302     TL35 tl;
303 }
304 
foo35(int x,long y,double z)305 void foo35(int x, long y, double z)
306 {
307     assert(x == 3);
308     assert(y == 8);
309     assert(z == 6.8);
310 }
311 
test35()312 void test35()
313 {
314     S35 s;
315 
316     s.tl[0] = 3;
317     s.tl[1] = 8;
318     s.tl[2] = 6.8;
319     foo35(s.tupleof);
320     foo35(s.tl);
321 }
322 
323 /***************************************/
324 
325 alias TypeTuple!(int, long, double) TL36;
326 
327 class C36
328 {
329     TL36 tl;
330 }
331 
foo36(int x,long y,double z)332 void foo36(int x, long y, double z)
333 {
334     assert(x == 3);
335     assert(y == 8);
336     assert(z == 6.8);
337 }
338 
test36()339 void test36()
340 {
341     C36 s = new C36;
342 
343     s.tl[0] = 3;
344     s.tl[1] = 8;
345     s.tl[2] = 6.8;
346     foo36(s.tupleof);
347     foo36(s.tl);
348 }
349 
350 /***************************************/
351 
352 
353 alias TypeTuple!(int, long, double) TL37;
354 
355 class C37
356 {
357     TL37 tl;
358 }
359 
foo37(int x,long y,double z)360 void foo37(int x, long y, double z)
361 {
362     assert(x == 3);
363     assert(y == 8);
364     assert(z == 6.8);
365 }
366 
test37()367 void test37()
368 {
369     C37 s = new C37;
370 
371     s.tl[0] = 3;
372     s.tl[1] = 8;
373     s.tl[2] = 6.8;
374     foo37(s.tupleof);
375 
376     TL37 x;
377     assert(x[0] == 0);
378     x[0] = 3;
379     assert(x[0] == 3);
380     assert(x[1] == 0);
381     x[1] = 8;
382     x[2] = 6.8;
383     foo37(x);
384 }
385 
386 /***************************************/
387 
388 interface I38A { }
389 interface I38B { }
390 
391 alias TypeTuple!(I38A, I38B) IL38;
392 
393 class C38 : IL38
394 {
395 }
396 
test38()397 void test38()
398 {
399     auto c = new C38;
400 }
401 
402 /***************************************/
403 
test39()404 void test39()
405 {
406     static const string a = "\x01";
407     static const char b = a[0];
408     static const string c = "test";
409     static assert(c[a[0]] == 'e');
410 
411     alias TypeTuple!(ulong,uint,ushort,ubyte) tuple;
412     static assert(is(tuple[1] == uint));
413     static assert(is(tuple[a[0]] == uint));
414 }
415 
416 /***************************************/
417 
418 struct Foo45
419 {
420     static TypeTuple!(int) selements1;
421     TypeTuple!(int) elements1;
422     static TypeTuple!() selements0;
423     TypeTuple!() elements0;
424 }
425 
test45()426 void test45()
427 {
428     Foo45 foo;
429 
430     static assert(Foo45.selements1.length == 1);
431     static assert(Foo45.elements1.length == 1);
432     static assert(Foo45.selements0.length == 0);
433     static assert(Foo45.elements0.length == 0);
434 
435     static assert(foo.selements1.length == 1);
436     static assert(foo.elements1.length == 1);
437     static assert(foo.selements0.length == 0);
438     static assert(foo.elements0.length == 0);
439 }
440 
441 /***************************************/
442 
Tuple46(E...)443 template Tuple46(E ...) { alias E Tuple46; }
444 
445 alias Tuple46!(float, float, 3) TP46;
446 alias TP46[1..$] TQ46;
447 
test46()448 void test46()
449 {
450     TQ46[0] f = TQ46[1];
451     assert(is(typeof(f) == float));
452     assert(f == 3);
453 }
454 
455 /***************************************/
456 
Foo47(T,Args...)457 template Foo47(T, Args...)
458 {
459     void bar(Args args, T t)
460     {
461     }
462 }
463 
test47()464 void test47()
465 {
466     alias Foo47!(int) aFoo;
467 }
468 
469 /***************************************/
470 
Tuple48(E...)471 template Tuple48(E...)
472 {
473     alias E Tuple48;
474 }
475 
VarArg48(T...)476 void VarArg48(T...)(T args)
477 {
478 }
479 
test48()480 void test48()
481 {
482     VarArg48( );
483     VarArg48( Tuple48!(1,2,3) );
484     VarArg48( Tuple48!()      );
485 }
486 
487 /***************************************/
488 
489 alias TypeTuple!(int, long) TX49;
490 
foo49(TX49 t)491 void foo49(TX49 t)
492 {
493     TX49 s;
494     s = t;
495     assert(s[0] == 1);
496     assert(s[1] == 2);
497 }
498 
test49()499 void test49()
500 {
501     foo49(1, 2);
502 }
503 
504 /***************************************/
505 
foo51(U...)506 void foo51(U...)(int t, U u)
507 {
508     assert(t == 1);
509     assert(u[0] == 2);
510     assert(u[1] == 3);
511 }
512 
bar51(U...)513 void bar51(U...)(U u, int t)
514 {
515     assert(u[0] == 1);
516     assert(u[1] == 2);
517     assert(t == 3);
518 }
519 
abc51(U...)520 void abc51(U...)(int s, U u, int t)
521 {
522     assert(s == 1);
523     assert(u[0] == 2);
524     assert(u[1] == 3);
525     assert(t == 4);
526 }
527 
test51()528 void test51()
529 {
530   foo51(1, 2, 3);
531   bar51(1, 2, 3);
532   bar51!(int, int)(1, 2, 3);
533   abc51(1,2,3,4);
534 }
535 
536 /***************************************/
537 
to55(U,V)538 string to55(U, V)(V s) { return "he"; }
539 
wyda(S,T...)540 private S wyda(S, T...)(T args)
541 {
542     S result;
543     foreach (i, arg; args)
544     {
545         result ~= to55!(S)(args[i]);
546     }
547     return result;
548 }
549 
giba(U...)550 string giba(U...)(U args)
551 {
552     return wyda!(string, U)(args);
553 }
554 
test55()555 void test55()
556 {
557     assert(giba(42, ' ', 1.5, ": xyz") == "hehehehe");
558 }
559 
560 /***************************************/
561 
implicitlyConverts(U,V)562 private template implicitlyConverts(U, V)
563 {
564     enum bool implicitlyConverts = V.sizeof >= U.sizeof
565         && is(typeof({U s; V t = s;}()));
566 }
567 
568 T to56(T, S)(S s)
569     if (!implicitlyConverts!(S, T) /*&& isSomeString!(T)
570         && isSomeString!(S)*/)
571 {
572     return T.init;
573 }
574 
test56()575 void test56()
576 {
577     auto x = to56!(int)("4");
578     assert(x == 0);
579     assert(!implicitlyConverts!(const(char)[], string));
580     assert(implicitlyConverts!(string, const(char)[]));
581 }
582 
583 /***************************************/
584 
A57(B...)585 struct A57(B...) {}
586 
test57()587 void test57()
588 {
589     alias A57!(int, float) X;
590     static if (!is(X Y == A57!(Z), Z...))
591     {
592         static assert(false);
593     }
594 }
595 
596 /***************************************/
597 
A58(B...)598 struct A58(B...) {}
599 
test58()600 void test58()
601 {
602     alias A58!(int, float) X;
603     static if (!is(X Y == A58!(Z), Z...))
604     {
605         static assert(false);
606     }
607 }
608 
609 /***************************************/
610 
Tuple59(T...)611 struct Tuple59(T...)
612 {
613     T field;
614 }
615 
reduce(fun...)616 template reduce(fun...)
617 {
618     alias Reduce!(fun).reduce reduce;
619 }
620 
Reduce(fun...)621 template Reduce(fun...)
622 {
623     Tuple59!(double, double)
624     reduce(Range)(Range r)
625     {
626         typeof(Tuple59!(double,double).field)[0] y;
627         typeof(typeof(return).field)[0] x;
628         Tuple59!(double, double) s;
629         return s;
630     }
631 }
632 
test59()633 void test59()
634 {
635     double[] a = [ 3.0, 4, 7, 11, 3, 2, 5 ];
636     static double sum(double a, double b) {return a + b;}
637     auto r = reduce!((a, b) { return a + b; },
638                      (a, b) { return a + b; })(a);
639 }
640 
641 /***************************************/
642 
tuple60(T...)643 template tuple60(T...)
644 {
645     alias T tuple60;
646 }
647 
648 template Foo60(S : void delegate(tuple60!(int))) {}
649 template Foo60(S : void delegate(tuple60!(int, int))) {}
650 
651 alias Foo60!(void delegate(int)) Bar60;
652 
test60()653 void test60()
654 {
655 }
656 
657 /***************************************/
658 
TypeTuple61(TList...)659 template TypeTuple61(TList...){
660     alias TList TypeTuple61;
661 }
List61(lst...)662 template List61(lst...) { alias lst list; }
663 alias TypeTuple61!(List61!(void)) A61;
664 alias TypeTuple61!(A61[0].list) B61;
665 
test61()666 void test61()
667 {
668 }
669 
670 /***************************************/
671 
Tuple63(T...)672 template Tuple63(T...){
673     alias T Tuple63;
674 }
675 // Bugzilla 3336
676 static assert(!is(int[ Tuple63!(int, int) ]));
677 
test63()678 void test63()
679 {
680 }
681 
682 /***************************************/
683 
Tuple1411(T...)684 template Tuple1411(T ...) { alias T Tuple1411; }
685 
test1411()686 void test1411()
687 {
688     int delegate(ref Tuple1411!(int, char[], real)) dg; // (*)
689     int f(ref int a, ref char[] b, ref real c) { return 77; }
690     dg = &f;
691 }
692 
693 /***************************************/
694 // Bugzilla 4444
695 
test4444()696 void test4444()
697 {
698     alias TypeTuple!(1) index;
699     auto arr = new int[4];
700     auto x = arr[index];    // error
701 }
702 
703 /***************************************/
704 // 13864
705 
Tuple13864(T...)706 struct Tuple13864(T...)
707 {
708     T expand;
709     alias expand this;
710 }
tuple13864(T...)711 auto tuple13864(T...)(T args)
712 {
713     return Tuple13864!T(args);
714 }
715 
test13864()716 void test13864()
717 {
718     int[] x = [2,3,4];
719     auto y = x[tuple13864(0).expand];
720     assert(y == 2);
721 }
722 
723 /***************************************/
724 // 4884
725 
A4884(T...)726 struct A4884(T...)
727 {
728     void foo(T) {}
729     void bar(bool, T) {}
730 }
731 
test4884()732 void test4884()
733 {
734     auto a1 = A4884!(int)();
735     auto a2 = A4884!(int, long)();
736 }
737 
738 /***************************************/
739 // 4920
740 
Test4920(parameters_...)741 struct Test4920(parameters_...)
742 {
743     alias parameters_ parameters;
744 }
745 
test4920()746 void test4920()
747 {
748     Test4920!(10, 20, 30) test;
749     static assert(typeof(test).parameters[1] == 20); // okay
750     static assert(       test .parameters[1] == 20); // (7)
751 }
752 
753 /***************************************/
754 // 4940
755 
Tuple4940(T...)756 template Tuple4940(T...)
757 {
758     alias T Tuple4940;
759 }
760 
761 struct S4940
762 {
763     Tuple4940!(int, int) x;
thisS4940764     this(int) { }
765 }
766 
test4940()767 void test4940()
768 {
769     auto w = S4940(0).x;
770 }
771 
772 //----
773 
774 struct S4940add
775 {
776     string s;
777     long x;
778 }
779 
get4940add(ref S4940add s)780 ref S4940add get4940add(ref S4940add s){ return s; }
781 
test4940add()782 void test4940add()
783 {
784     S4940add s;
785     get4940add(s).tupleof[1] = 20;
786     assert(s.x == 20);
787 }
788 
789 /***************************************/
790 // 6530
791 
792 struct S6530
793 {
794     int a, b, c;
795 }
796 
797 struct HasPostblit6530
798 {
this(this)799     this(this) {}  // Bug goes away without this.
800 }
801 
toRandomAccessTuple6530(T...)802 auto toRandomAccessTuple6530(T...)(T input, HasPostblit6530 hasPostblit)
803 {
804     return S6530(1, 2, 3);
805 }
806 
doStuff6530(T...)807 void doStuff6530(T...)(T args)
808 {
809     HasPostblit6530 hasPostblit;
810 
811     // Bug goes away without the .tupleof.
812     auto foo = toRandomAccessTuple6530(args, hasPostblit).tupleof;
813 }
814 
test6530()815 void test6530()
816 {
817     doStuff6530(1, 2, 3);
818 }
819 
820 /***************************************/
821 
822 import core.stdc.stdarg;
823 
824 extern(C)
func9495(int a,string format,...)825 void func9495(int a, string format, ...)
826 {
827     va_list ap;
828     va_start(ap, format);
829     auto a1 = va_arg!int(ap);
830     auto a2 = va_arg!int(ap);
831     auto a3 = va_arg!int(ap);
832     assert(a1 == 0x11111111);
833     assert(a2 == 0x22222222);
834     assert(a3 == 0x33333333);
835     va_end(ap);
836 }
837 
test9495()838 void test9495()
839 {
840     func9495(0, "", 0x11111111, 0x22222222, 0x33333333);
841 }
842 
843 /***************************************/
844 
copya(int a,string format,...)845 void copya(int a, string format, ...)
846 {
847     va_list ap;
848     va_start(ap, format);
849 
850     va_list ap2;
851     va_copy(ap2, ap);
852 
853     auto a1 = va_arg!int(ap);
854     auto a2 = va_arg!int(ap);
855     auto a3 = va_arg!int(ap);
856 
857     assert(a1 == 0x11111111);
858     assert(a2 == 0x22222222);
859     assert(a3 == 0x33333333);
860 
861     auto b1 = va_arg!int(ap2);
862     auto b2 = va_arg!int(ap2);
863     auto b3 = va_arg!int(ap2);
864 
865     assert(b1 == 0x11111111);
866     assert(b2 == 0x22222222);
867     assert(b3 == 0x33333333);
868 
869     va_end(ap);
870     va_end(ap2);
871 }
872 
testCopy()873 void testCopy()
874 {
875     copya(0, "", 0x11111111, 0x22222222, 0x33333333);
876 }
877 
878 /***************************************/
879 // 6700
880 
bug6700(TList...)881 template bug6700(TList ...) {
882     const int bug6700 = 2;
883 }
884 TypeTuple!(int, long) TT6700;
885 
886 static assert(bug6700!( (TT6700[1..$]) )==2);
887 
888 /***************************************/
889 // 6966
890 
X6966(T...)891 template X6966(T...)
892 {
893     alias const(T[0]) X6966;
894 }
895 static assert(is(X6966!(int) == const(int)));
896 static assert(is(X6966!(int, 0) == const(int)));
897 
898 /***************************************/
899 // 7233
900 
901 struct Foo7233 { int x, y; }
front7233(Foo7233[][]a)902 Foo7233[] front7233(Foo7233[][] a)
903 {
904     return a[0];
905 }
906 
907 class Bar7233 { int x, y; }
front7233(Bar7233[][]a)908 Bar7233[] front7233(Bar7233[][] a)
909 {
910     return a[0];
911 }
912 
test7233()913 void test7233()
914 {
915     Foo7233[][] b1 = [[Foo7233()]];
916     auto xy1 = b1.front7233[0].tupleof;
917 
918     Bar7233[][] b2 = [[new Bar7233()]];
919     auto xy2 = b2.front7233[0].tupleof;
920 }
921 
922 /***************************************/
923 // 7263
924 
TypeTuple7263(T...)925 template TypeTuple7263(T...){ alias T TypeTuple7263; }
926 
927 struct tuple7263
928 {
929     TypeTuple7263!(int, int) field;
930     alias field this;
931 }
932 
front7263(T)933 auto front7263(T)(ref T arr){ return arr[0]; }
934 
test7263()935 void test7263()
936 {
937     auto bars = [tuple7263(0, 0), tuple7263(1, 1)];
938     auto spam1 = bars.front7263[1];
939     auto spam2 = bars.front7263[1..2];
940 }
941 
942 /***************************************/
943 // 8244
944 
945 TypeTuple!(int,int)[] x8244;
946 static assert(is(typeof(x8244) == TypeTuple!(int, int)));
947 
948 /***************************************/
949 // 9017
950 
X9017(Args...)951 template X9017(Args...)
952 {
953     static if(__traits(compiles, { enum e = Args; }))
954         enum e = Args;
955 }
956 alias X9017!0 x9017;
957 static assert(x9017.e[0] == 0);
958 
test9017()959 void test9017()
960 {
961     enum tup1 = TypeTuple!(11, 22);
962     enum tup2 = TypeTuple!("one", "two");
963     static assert(tup1 == TypeTuple!(11, 22));
964     static assert(tup2 == TypeTuple!("one", "two"));
965     static assert(tup1[0] == 11 && tup1[1] == 22);
966     static assert(tup2[0] == "one" && tup2[1] == "two");
967 
968     shared const tup3 = TypeTuple!(10, 3.14);
969     immutable    tup4 = TypeTuple!("a", [1,2]);
970     static assert(is(typeof(tup3[0]) == shared const int));
971     static assert(is(typeof(tup3[1]) == shared const double));
972     static assert(is(typeof(tup4[0]) == immutable string));
973     static assert(is(typeof(tup4[1]) == immutable int[]));
974 }
975 
976 /***************************************/
977 // 10279
978 
foo10279(int[][]strs...)979 void foo10279(int[][] strs...) @trusted { }
bar10279()980 void bar10279() @safe { foo10279(); }
981 
982 /***************************************/
983 // 13508
984 
985 struct S13508
986 {
thisS13508987     this(T)(T[] t...) {}
988 }
989 
make13508(T)990 template make13508(T)
991 {
992     T make13508(Args...)(Args args)
993     {
994         return T(args);
995     }
996 }
997 
test13508()998 void test13508() @safe @nogc
999 {
1000     S13508 s = make13508!S13508(5);
1001 }
1002 
1003 /***************************************/
1004 // 14395
1005 
v2u14395(uint[1]ar...)1006 int v2u14395(uint[1] ar...)
1007 {
1008     return ar[0];
1009 }
1010 
1011 void print14395(int size = v2u14395(7))
1012 {
1013     assert(size == 7);
1014 }
1015 
test14395()1016 void test14395()
1017 {
1018     print14395();
1019 }
1020 
1021 /***************************************/
1022 // 10414
1023 
foo10414(void delegate ()[]...)1024 void foo10414(void delegate()[] ...) { }
1025 
bar10414()1026 void bar10414() { }
1027 
test10414()1028 void test10414()
1029 {
1030     foo10414
1031     (
1032         { bar10414(); },
1033         { bar10414(); },
1034     );
1035 }
1036 
1037 /***************************************/
1038 
1039 import core.stdc.stdarg;
1040 
1041 struct S14179
1042 {
1043     const(char)* filename;
1044     uint linnum;
1045     uint charnum;
1046 }
1047 
func14179(S14179 x,const (char)* string,...)1048 extern(C++) const(char)* func14179(S14179 x, const(char)* string, ...)
1049 {
1050     return string;
1051 }
1052 
test14179()1053 void test14179()
1054 {
1055     const(char)* s = "hello";
1056     assert(func14179(S14179(), s) == s);
1057 }
1058 
1059 /***************************************/
1060 // 10722
1061 
1062 struct S10722
1063 {
1064     int x;
1065 }
1066 
GetSomething10722(S...)1067 template GetSomething10722(S...)
1068 {
1069     alias GetSomething = int;
1070 }
1071 
test10722()1072 void test10722()
1073 {
1074     alias X10722 = GetSomething10722!(S10722.tupleof[0]);
1075 }
1076 
1077 /***************************************/
1078 
testx15417(ulong c1,...)1079 void testx15417(ulong c1, ...)
1080 {
1081     check(c1, _argptr, _arguments);
1082 }
1083 
1084 class C15417
1085 {
method()1086     private void method ()
1087     {
1088         void test1 (ulong c1, ...)
1089         {
1090             check(c1, _argptr, _arguments);
1091         }
1092 
1093         void test2 (ulong c1, ...)
1094         {
1095             va_list ap;
1096             va_start(ap, c1);
1097 
1098             check(c1, ap, _arguments);
1099         }
1100 
1101         testx15417(4242UL, char.init);
1102         test1(4242UL, char.init);
1103         test2(4242UL, char.init);
1104     }
1105 }
1106 
check(ulong c1,va_list arglist,TypeInfo[]ti)1107 void check (ulong c1, va_list arglist, TypeInfo[] ti)
1108 {
1109     assert(ti.length == 1);
1110     assert(ti[0].toString() == "char");
1111     assert(char.init == va_arg!(char)(arglist));
1112 }
1113 
test15417()1114 void test15417()
1115 {
1116     auto c = new C15417;
1117     c.method;
1118 }
1119 
1120 
1121 /***************************************/
1122 
main()1123 int main()
1124 {
1125     test1();
1126     test2();
1127     test3();
1128     test4();
1129     test12();
1130     test13();
1131     test14();
1132     test24();
1133     test28();
1134     test32();
1135     test34();
1136     test35();
1137     test36();
1138     test37();
1139     test38();
1140     test39();
1141     test45();
1142     test46();
1143     test47();
1144     test48();
1145     test49();
1146     test51();
1147     test55();
1148     test56();
1149     test57();
1150     test58();
1151     test59();
1152     test60();
1153     test61();
1154     test63();
1155     test1411();
1156     test4444();
1157     test13864();
1158     test4884();
1159     test4920();
1160     test4940();
1161     test4940add();
1162     test6530();
1163     test7233();
1164     test7263();
1165     test9017();
1166     test14395();
1167     test10414();
1168     test9495();
1169     testCopy();
1170     test14179();
1171     test15417();
1172 
1173     return 0;
1174 }
1175