Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/ice12501.d

raw
1 /*
2 TEST_OUTPUT:
3 ----
4 fail_compilation/ice12501.d(33): Error: function `foo` is not callable using argument types `(int, int)`
5 fail_compilation/ice12501.d(33): expected 1 argument(s), not 2
6 fail_compilation/ice12501.d(40): `ice12501.foo(int value)` declared here
7 fail_compilation/ice12501.d(33): Error: function `foo` is not callable using argument types `(int, int)`
8 fail_compilation/ice12501.d(33): expected 1 argument(s), not 2
9 fail_compilation/ice12501.d(40): `ice12501.foo(int value)` declared here
10 fail_compilation/ice12501.d(47): Error: template instance `ice12501.reduce!(foo, foo).reduce!(Tuple!(int, int), int[])` error instantiating
11 ----
12 */
13
14 struct Tuple(T...)
15 {
16 alias Types = T;
17 T field;
18 alias field this;
19 }
20 Tuple!A tuple(A...)(A args) { return typeof(return)(args); }
21
22 template reduce(fun...)
23 {
24 auto reduce(Args...)(Args args)
25 {
26 alias seed = args[0];
27 alias r = args[1];
28 Args[0] result = seed;
29 for (; r.length != 0; r = r[1..$])
30 {
31 foreach (i, Unused; Args[0].Types)
32 {
33 result[i] = fun[i](result[i], r[0]);
34 }
35 }
36 return result;
37 }
38 }
39
40 int foo(int value)
41 {
42 return value;
43 }
44
45 void main()
46 {
47 reduce!(foo, foo)(tuple(0, 0), [ 1 ]);
48 }