Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail10968.d(43): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
5 fail_compilation/fail10968.d(43): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
6 fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
7 fail_compilation/fail10968.d(44): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
8 fail_compilation/fail10968.d(44): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
9 fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
10 fail_compilation/fail10968.d(45): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
11 fail_compilation/fail10968.d(45): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
12 fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
13 fail_compilation/fail10968.d(48): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
14 fail_compilation/fail10968.d(48): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
15 fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
16 fail_compilation/fail10968.d(49): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
17 fail_compilation/fail10968.d(49): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
18 fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
19 fail_compilation/fail10968.d(50): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
20 fail_compilation/fail10968.d(50): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
21 fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
22 ---
23 */
24
25 #line 29
26 struct SA
27 {
28 this(this)
29 {
30 throw new Exception("BOOM!");
31 }
32 }
33
34 void bar() pure @safe
35 {
36 SA ss;
37 SA[1] sa;
38
39 // TOKassign
40 ss = ss;
41 sa = ss;
42 sa = sa;
43
44 // TOKconstruct
45 SA ss2 = ss;
46 SA[1] sa2 = ss;
47 SA[1] sa3 = sa;
48 }
49
50 /*
51 TEST_OUTPUT:
52 ---
53 fail_compilation/fail10968.d(76): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
54 fail_compilation/fail10968.d(77): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
55 fail_compilation/fail10968.d(78): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
56 fail_compilation/fail10968.d(81): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
57 fail_compilation/fail10968.d(82): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
58 fail_compilation/fail10968.d(83): Error: struct `fail10968.SD` is not copyable because it has a disabled postblit
59 ---
60 */
61
62 struct SD
63 {
64 this(this) @disable;
65 }
66
67 void baz()
68 {
69 SD ss;
70 SD[1] sa;
71
72 // TOKassign
73 ss = ss;
74 sa = ss;
75 sa = sa;
76
77 // TOKconstruct
78 SD ss2 = ss;
79 SD[1] sa2 = ss;
80 SD[1] sa3 = sa;
81 }