d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test21546.d
blob22565e4a8a2e378a17e147f1d1f86e2eef7fc05c
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 ---
12 // https://issues.dlang.org/show_bug.cgi?id=21546
14 #line 100
16 alias Pm = int* delegate() return;
17 alias Pc = const(int)* delegate() return;
18 alias Pi = immutable(int)* delegate() return;
20 void f()
22 Pm pm;
23 Pc pc;
24 Pi pi;
25 pc = pm;
26 pc = pi;
28 pm = pc;
29 pi = pc;
30 pm = pi;
33 #line 200
35 alias DGm = ref int delegate() return;
36 alias DGc = ref const(int) delegate() return;
37 alias DGi = ref immutable(int) delegate() return;
39 void g()
41 DGm dm;
42 DGc dc;
43 DGi di;
44 dc = dm;
45 dc = di;
47 dm = dc;
48 di = dc;
49 dm = di;
52 #line 300
54 void h()
56 immutable int i = 0;
57 DGi dgi = ref() => i;
58 DGm[] dgms = [ dgi ];