]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gdc.test/fail_compilation/diag13884.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag13884.d
CommitLineData
b4c522fa
IB
1/*
2TEST_OUTPUT:
3---
4fail_compilation/diag13884.d(14): Error: functions cannot return a tuple
5fee5ec3
IB
5fail_compilation/diag13884.d(21): instantiated from here: `MapResult!((t) => t.tupleof, Foo[])`
6fail_compilation/diag13884.d(14): instantiated from here: `map!(Foo[])`
b4c522fa
IB
7---
8*/
9
10struct Foo { int x; }
11
12void main()
13{
14 [Foo(1)].map!(t => t.tupleof);
15}
16
17template map(fun...)
18{
19 auto map(Range)(Range r)
20 {
21 return MapResult!(fun, Range)(r);
22 }
23}
24
25struct MapResult(alias fun, R)
26{
27 R _input;
28
29 @property auto ref front()
30 {
31 return fun(_input[0]);
32 }
33
34}