5 fail_compilation/fail_scope.d(44): Error: returning `cast(char[])string` escapes a reference to local variable `string`
6 fail_compilation/fail_scope.d(62): Error: returning `s.bar()` escapes a reference to local variable `s`
7 fail_compilation/fail_scope.d(73): Error: `fail_scope.foo8` called with argument types `(int)` matches both:
8 fail_compilation/fail_scope.d(67): `fail_scope.foo8(ref int x)`
10 fail_compilation/fail_scope.d(68): `fail_scope.foo8(return ref int x)`
11 fail_compilation/fail_scope.d(81): Error: returning `& string` escapes a reference to local variable `string`
12 fail_compilation/fail_scope.d(91): Error: returning `cast(int[])a` escapes a reference to local variable `a`
13 fail_compilation/fail_scope.d(99): Error: returning `cast(int[])a` escapes a reference to local variable `a`
14 fail_compilation/fail_scope.d(107): Deprecation: escaping reference to outer local variable `x`
15 fail_compilation/fail_scope.d(126): Error: returning `s.bar()` escapes a reference to local variable `s`
16 fail_compilation/fail_scope.d(136): Error: returning `foo16226(i)` escapes a reference to local variable `i`
18 //fail_compilation/fail_scope.d(30): Error: scope variable `da` may not be returned
19 //fail_compilation/fail_scope.d(32): Error: scope variable `o` may not be returned
20 //fail_compilation/fail_scope.d(33): Error: scope variable `dg` may not be returned
21 //fail_compilation/fail_scope.d(35): Error: scope variable `da` may not be returned
22 //fail_compilation/fail_scope.d(37): Error: scope variable `o` may not be returned
23 //fail_compilation/fail_scope.d(38): Error: scope variable `dg` may not be returned
24 //fail_compilation/fail_scope.d(40): Error: scope variable `p` may not be returned
27 alias int delegate() dg_t;
29 int[] checkEscapeScope1(scope int[] da) { return da; }
30 int[3] checkEscapeScope2(scope int[3] sa) { return sa; }
31 Object checkEscapeScope3(scope Object o) { return o; }
32 dg_t checkEscapeScope4(scope dg_t dg) { return dg; }
34 int[] checkEscapeScope1() { scope int[] da = []; return da; }
35 int[3] checkEscapeScope2() { scope int[3] sa = [1,2,3]; return sa; }
36 Object checkEscapeScope3() { scope Object o = new Object; return o; } // same with fail7294.d
37 dg_t checkEscapeScope4() { scope dg_t dg = () => 1; return dg; }
39 int* test(scope int* p) @safe { return p; }
43 char[4] string = "abcd";
67 ref int foo8(ref int x);
68 ref int foo8(return ref int x);
80 char[4] string = "abcd";
103 // https://issues.dlang.org/show_bug.cgi?id=15192
105 ref int fun15192(ref int x) @safe
107 ref int bar(){ return x; }
111 ref int fun15192_2(return ref int x) @safe
113 ref int bar(){ return x; }
117 /**************************/
118 // https://issues.dlang.org/show_bug.cgi?id=15193
120 ref int foo15193()@safe{
123 ref int bar() { return x; }
130 /*****************************/
131 // https://issues.dlang.org/show_bug.cgi?id=16226
133 ref int test16226() @safe
140 ref foo16226(ref int bar) @safe