4 fail_compilation/fail_scope.d(28): Deprecation: scope parameter `da` may not be returned
5 fail_compilation/fail_scope.d(30): Deprecation: scope parameter `o` may not be returned
6 fail_compilation/fail_scope.d(31): Deprecation: scope parameter `dg` may not be returned
7 fail_compilation/fail_scope.d(38): Deprecation: scope parameter `p` may not be returned
8 fail_compilation/fail_scope.d(43): Error: returning `cast(char[])string` escapes a reference to local variable `string`
9 fail_compilation/fail_scope.d(61): Error: returning `s.bar()` escapes a reference to local variable `s`
10 fail_compilation/fail_scope.d(72): Error: `fail_scope.foo8` called with argument types `(int)` matches both:
11 fail_compilation/fail_scope.d(66): `fail_scope.foo8(ref int x)`
13 fail_compilation/fail_scope.d(67): `fail_scope.foo8(return ref int x)`
14 fail_compilation/fail_scope.d(80): Error: returning `& string` escapes a reference to local variable `string`
15 fail_compilation/fail_scope.d(90): Error: returning `cast(int[])a` escapes a reference to local variable `a`
16 fail_compilation/fail_scope.d(98): Error: returning `cast(int[])a` escapes a reference to local variable `a`
17 fail_compilation/fail_scope.d(106): Error: escaping reference to outer local variable `x`
18 fail_compilation/fail_scope.d(135): Error: returning `foo16226(i)` escapes a reference to local variable `i`
20 //fail_compilation/fail_scope.d(35): Error: scope variable `da` may not be returned
21 //fail_compilation/fail_scope.d(37): Error: scope variable `o` may not be returned
22 //fail_compilation/fail_scope.d(38): Error: scope variable `dg` may not be returned
23 //fail_compilation/fail_scope.d(40): Error: scope variable `p` may not be returned
26 alias int delegate() dg_t
;
28 int[] checkEscapeScope1(scope int[] da) { return da; }
29 int[3] checkEscapeScope2(scope int[3] sa
) { return sa
; }
30 Object
checkEscapeScope3(scope Object o
) { return o
; }
31 dg_t
checkEscapeScope4(scope dg_t dg
) { return dg
; }
33 int[] checkEscapeScope1() { scope int[] da = []; return da; }
34 int[3] checkEscapeScope2() { scope int[3] sa
= [1,2,3]; return sa
; }
35 Object
checkEscapeScope3() { scope Object o
= new Object
; return o
; } // same with fail7294.d
36 dg_t
checkEscapeScope4() { scope dg_t dg
= () => 1; return dg
; }
38 int* test(scope int* p
) @safe { return p
; }
42 char[4] string
= "abcd";
66 ref int foo8(ref int x
);
67 ref int foo8(return ref int x
);
79 char[4] string
= "abcd";
102 // https://issues.dlang.org/show_bug.cgi?id=15192
104 ref int fun15192(ref int x
) @safe
106 ref int bar(){ return x
; }
110 ref int fun15192_2(return ref int x
) @safe
112 ref int bar(){ return x
; }
116 /**************************/
117 // https://issues.dlang.org/show_bug.cgi?id=15193
119 ref int foo15193()@safe{
122 ref int bar() { return x
; }
129 /*****************************/
130 // https://issues.dlang.org/show_bug.cgi?id=16226
132 ref int test16226() @safe
139 ref foo16226(ref int bar
) @safe