]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/ice14096.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / ice14096.d
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/ice14096.d(29): Error: cannot access frame pointer of ice14096.main.Baz!((i) => i).Baz
5 fail_compilation/ice14096.d(23): Error: template instance ice14096.foo!(Tuple!(Baz!((i) => i))).foo.bar!(t) error instantiating
6 fail_compilation/ice14096.d(40): instantiated from here: foo!(Tuple!(Baz!((i) => i)))
7 ---
8 */
9
10 struct Tuple(Types...)
11 {
12 Types expand;
13 alias expand this;
14 alias field = expand;
15 }
16 Tuple!T tuple(T...)(T args)
17 {
18 return typeof(return)(args);
19 }
20
21 auto foo(T)(T t)
22 {
23 bar!t();
24 }
25
26 auto bar(alias s)()
27 {
28 // default construction is not possible for: Tuple!(Baz!(i => i))
29 typeof(s) p;
30 }
31
32 struct Baz(alias f)
33 {
34 void g() {}
35 }
36
37 void main()
38 {
39 auto t = tuple(Baz!(i => i)());
40 foo(t);
41 }