1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail9414b.d(47): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
5 fail_compilation/fail9414b.d(34): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
6 fail_compilation/fail9414b.d(35): Error: variable fail9414b.C.foo.__require.bar.y cannot modify parameter 'y' in contract
7 fail_compilation/fail9414b.d(40): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
8 fail_compilation/fail9414b.d(41): Error: variable fail9414b.C.foo.__require.bar.y cannot modify parameter 'y' in contract
9 fail_compilation/fail9414b.d(42): Error: variable fail9414b.C.foo.__require.bar.s cannot modify result 's' in contract
10 fail_compilation/fail9414b.d(52): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
11 fail_compilation/fail9414b.d(75): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
12 fail_compilation/fail9414b.d(76): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
13 fail_compilation/fail9414b.d(60): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
14 fail_compilation/fail9414b.d(61): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
15 fail_compilation/fail9414b.d(62): Error: variable fail9414b.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract
16 fail_compilation/fail9414b.d(67): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
17 fail_compilation/fail9414b.d(68): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
18 fail_compilation/fail9414b.d(69): Error: variable fail9414b.C.foo.__ensure.baz.y cannot modify parameter 'y' in contract
19 fail_compilation/fail9414b.d(70): Error: variable fail9414b.C.foo.__ensure.baz.s cannot modify result 's' in contract
20 fail_compilation/fail9414b.d(81): Error: variable fail9414b.C.foo.x cannot modify parameter 'x' in contract
21 fail_compilation/fail9414b.d(82): Error: variable fail9414b.C.foo.__ensure.r cannot modify result 'r' in contract
22 ---
23 */
24 
25 class C
26 {
foo(int x)27     final int foo(int x)
28     in
29     {
30         int a;
31         int bar(int y)
32         in
33         {
34             x = 10; // err
35             y = 10; // err
36             a = 1;  // OK
37         }
38         out(s)
39         {
40             x = 10; // err
41             y = 10; // err
42             s = 10; // err
43             a = 1;  // OK
44         }
45         body
46         {
47             x = 10; // err
48             y = 1;  // OK
49             a = 1;  // OK
50             return 2;
51         }
52         x = 10; // err
53     }
out(r)54     out(r)
55     {
56         int a;
57         int baz(int y)
58         in
59         {
60             x = 10; // err
61             r = 10; // err
62             y = 10; // err
63             a = 1;  // OK
64         }
65         out(s)
66         {
67             x = 10; // err
68             r = 10; // err
69             y = 10; // err
70             s = 10; // err
71             a = 1;  // OK
72         }
73         body
74         {
75             x = 10; // err
76             r = 10; // err
77             y = 1;  // OK
78             a = 1;  // OK
79             return 2;
80         }
81         x = 10; // err
82         r = 10; // err
83     }
84     body
85     {
86         return 1;
87     }
88 }
89