summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/test21546.d
blob: 22565e4a8a2e378a17e147f1d1f86e2eef7fc05c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* TEST_OUTPUT:
---
fail_compilation/test21546.d(113): Error: cannot implicitly convert expression `pc` of type `const(int)* delegate() return` to `int* delegate() return`
fail_compilation/test21546.d(114): Error: cannot implicitly convert expression `pc` of type `const(int)* delegate() return` to `immutable(int)* delegate() return`
fail_compilation/test21546.d(115): Error: cannot implicitly convert expression `pi` of type `immutable(int)* delegate() return` to `int* delegate() return`
fail_compilation/test21546.d(213): Error: cannot implicitly convert expression `dc` of type `const(int) delegate() ref return` to `int delegate() ref return`
fail_compilation/test21546.d(214): Error: cannot implicitly convert expression `dc` of type `const(int) delegate() ref return` to `immutable(int) delegate() ref return`
fail_compilation/test21546.d(215): Error: cannot implicitly convert expression `di` of type `immutable(int) delegate() ref return` to `int delegate() ref return`
fail_compilation/test21546.d(305): Error: cannot implicitly convert expression `[dgi]` of type `immutable(int) delegate() ref return[]` to `int delegate() ref return[]`
---
 */
// https://issues.dlang.org/show_bug.cgi?id=21546

#line 100

alias Pm =           int*  delegate() return;
alias Pc =     const(int)* delegate() return;
alias Pi = immutable(int)* delegate() return;

void f()
{
    Pm pm;
    Pc pc;
    Pi pi;
    pc = pm;
    pc = pi;

    pm = pc;
    pi = pc;
    pm = pi;
}

#line 200

alias DGm = ref           int  delegate() return;
alias DGc = ref     const(int) delegate() return;
alias DGi = ref immutable(int) delegate() return;

void g()
{
    DGm dm;
    DGc dc;
    DGi di;
    dc = dm;
    dc = di;

    dm = dc;
    di = dc;
    dm = di;
}

#line 300

void h()
{
    immutable int i = 0;
    DGi dgi = ref() => i;
    DGm[] dgms = [ dgi ];
}