Debian Codegraph @

gcc/testsuite/gdc.test/runnable/ice10086b.d

raw
1 // EXTRA_SOURCES: imports/ice10086y.d
2 // EXTRA_SOURCES: imports/ice10086x.d
3
4 import imports.ice10086y;
5 import imports.ice10086x;
6
7 void main() { test(); }
8
9 static if (0)
10 {
11 /* this is a reduced one-file version that triggers a seg fault
12 because the use of OPframeptr gets inlined, and the offests
13 to it are not updated.
14 Compile with: -O -inline
15 */
16
17 pragma(inline, false)
18 auto bind(alias f, bindValues...)()
19 {
20 pragma(inline, false)
21 auto bind(Types...)(Types values)
22 {
23 return f(bindValues, values);
24 }
25 return bind();
26 }
27
28
29 struct SS
30 {
31 int a1 = 123;
32 }
33
34 pragma(inline, false)
35 @safe auto ff(SS rr)
36 {
37 return rr;
38 }
39
40 // pragma(inline, false)
41 @safe auto gg(SS ss) // this getting inlined triggers the problem
42 {
43 return bind!(ff, ss);
44 }
45
46 pragma(inline, false)
47 void test()
48 {
49 SS s1;
50
51 auto zb = bind!(gg, s1)();
52 assert(zb.a1 == 123);
53 }
54
55
56 void main() { test(); }
57 }