d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag13884.d
blob14af2c884a9c11d83a44556a4f5095758cbe8a42
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag13884.d(14): Error: functions cannot return a sequence (use `std.typecons.Tuple`)
5 fail_compilation/diag13884.d(21): instantiated from here: `MapResult!((t) => t.tupleof, Foo[])`
6 fail_compilation/diag13884.d(14): instantiated from here: `map!(Foo[])`
7 ---
8 */
10 struct Foo { int x; }
12 void main()
14 [Foo(1)].map!(t => t.tupleof);
17 template map(fun...)
19 auto map(Range)(Range r)
21 return MapResult!(fun, Range)(r);
25 struct MapResult(alias fun, R)
27 R _input;
29 @property auto ref front()
31 return fun(_input[0]);