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