MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / ice12574.d
blobecb0fd69a05bf5ad2312c37bd0ea0c6a15c8bf1f
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/ice12574.d(40): Error: sequence index `2` out of bounds `[0 .. 2]`
5 fail_compilation/ice12574.d(53): Error: template instance `ice12574.reduce!("a", "a").reduce!(Tuple!(int, int, int))` error instantiating
6 ---
7 */
9 struct Tuple(T...)
11 alias Types = T;
12 T field;
13 alias field this;
15 Tuple!A tuple(A...)(A args) { return typeof(return)(args); }
17 template binaryFun(alias fun)
19 static if (is(typeof(fun) : string))
21 auto binaryFun(ElementType1, ElementType2)(auto ref ElementType1 __a, auto ref ElementType2 __b)
23 mixin("alias "~"a"~" = __a ;");
24 mixin("alias "~"b"~" = __b ;");
25 return mixin(fun);
28 else
30 alias binaryFun = fun;
34 template reduce(fun...)
36 auto reduce(Seed)(Seed result)
38 foreach (i, Unused; Seed.Types)
40 result[i] = binaryFun!(fun[i])(1, 1); // here
42 return result;
46 int foo(int value)
48 return value;
51 void main()
53 reduce!("a", "a")(tuple(1, 1, 1));