Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/test21546.d

raw
1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/test21546.d(113): Error: cannot implicitly convert expression `pc` of type `const(int)* delegate() return` to `int* delegate() return`
4 fail_compilation/test21546.d(114): Error: cannot implicitly convert expression `pc` of type `const(int)* delegate() return` to `immutable(int)* delegate() return`
5 fail_compilation/test21546.d(115): Error: cannot implicitly convert expression `pi` of type `immutable(int)* delegate() return` to `int* delegate() return`
6 fail_compilation/test21546.d(213): Error: cannot implicitly convert expression `dc` of type `const(int) delegate() ref return` to `int delegate() ref return`
7 fail_compilation/test21546.d(214): Error: cannot implicitly convert expression `dc` of type `const(int) delegate() ref return` to `immutable(int) delegate() ref return`
8 fail_compilation/test21546.d(215): Error: cannot implicitly convert expression `di` of type `immutable(int) delegate() ref return` to `int delegate() ref return`
9 fail_compilation/test21546.d(305): Error: cannot implicitly convert expression `[dgi]` of type `immutable(int) delegate() ref return[]` to `int delegate() ref return[]`
10 ---
11 */
12 // https://issues.dlang.org/show_bug.cgi?id=21546
13
14 #line 100
15
16 alias Pm = int* delegate() return;
17 alias Pc = const(int)* delegate() return;
18 alias Pi = immutable(int)* delegate() return;
19
20 void f()
21 {
22 Pm pm;
23 Pc pc;
24 Pi pi;
25 pc = pm;
26 pc = pi;
27
28 pm = pc;
29 pi = pc;
30 pm = pi;
31 }
32
33 #line 200
34
35 alias DGm = ref int delegate() return;
36 alias DGc = ref const(int) delegate() return;
37 alias DGi = ref immutable(int) delegate() return;
38
39 void g()
40 {
41 DGm dm;
42 DGc dc;
43 DGi di;
44 dc = dm;
45 dc = di;
46
47 dm = dc;
48 di = dc;
49 dm = di;
50 }
51
52 #line 300
53
54 void h()
55 {
56 immutable int i = 0;
57 DGi dgi = ref() => i;
58 DGm[] dgms = [ dgi ];
59 }