Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test22420.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=22420
2
3 struct File
4 {
5 ~this()
6 {
7 }
8 File impl()
9 {
10 return File.init;
11 }
12 alias impl this;
13 }
14 struct Variable
15 {
16 this(File)(File) { }
17 this(File)(File[]) { }
18 }
19 Variable wrapFunctionReturn(alias handler)(Variable params)
20 {
21 return Variable(handler(params));
22 }
23 void registerFile()
24 {
25 wrapFunctionReturn!((Variable) {
26 return File.init;
27 })(Variable.init);
28 }
29
30 // Reduction from an 'automem' test
31
32 struct Issue156 {}
33
34 void test2()
35 {
36 RefCounted!Issue156 s;
37 auto r1 = repeat(s);
38 zip(r1);
39 }
40
41 struct RefCounted(RefCountedType)
42 {
43 ~this() {}
44 alias _impl this;
45
46 struct Impl {}
47 alias ImplType = Impl;
48
49 private ImplType* _impl;
50
51 }
52 template Tuple(Specs)
53 {
54 struct Tuple
55 {
56 this(U)(U) {}
57 this()(int) {}
58 }
59 }
60
61 template ElementType(R)
62 {
63 static if (is(typeof(R.init) T))
64 alias ElementType = T;
65 }
66
67 struct Repeat(T)
68 {
69 inout(T) front() inout {assert(0);}
70 }
71
72 Repeat!T repeat(T)(T ) {assert(0);}
73
74 auto zip(Ranges)(Ranges )
75 {
76 return ZipShortest!Ranges();
77 }
78
79 struct ZipShortest(Ranges...)
80 {
81 Ranges ranges;
82 alias ElementType = Tuple!(.ElementType!(Ranges[0]));
83
84 ElementType front()
85 {
86 return typeof(return)(ranges[0].front);
87 }
88 }