1 /* PERMUTE_ARGS:
2 REQUIRED_ARGS: -dip1000
3 TEST_OUTPUT:
4 ---
5 fail_compilation/test16589.d(26): Error: returning `&this.data` escapes a reference to parameter `this`, perhaps annotate with `return`
6 fail_compilation/test16589.d(31): Error: returning `&this` escapes a reference to parameter `this`, perhaps annotate with `return`
7 fail_compilation/test16589.d(37): Error: returning `&s.data` escapes a reference to parameter `s`, perhaps annotate with `return`
8 fail_compilation/test16589.d(42): Error: returning `&s` escapes a reference to parameter `s`, perhaps annotate with `return`
9 fail_compilation/test16589.d(47): Error: returning `&s.data` escapes a reference to parameter `s`, perhaps annotate with `return`
10 fail_compilation/test16589.d(52): Error: returning `& s` escapes a reference to parameter `s`, perhaps annotate with `return`
11 ---
12 */
13 
14 
15 
16 
17 
18 // https://issues.dlang.org/show_bug.cgi?id=16589
19 
20 struct S
21 {
22     int data;
23 
access1S24     @safe int* access1()
25     {
26         return &data;
27     }
28 
access2S29     @safe S* access2()
30     {
31         return &this;
32     }
33 }
34 
access3(ref S s)35 @safe int* access3(ref S s)
36 {
37     return &s.data;
38 }
39 
access4(ref S s)40 @safe S* access4(ref S s)
41 {
42     return &s;
43 }
44 
access5(S s)45 @safe int* access5(S s)
46 {
47     return &s.data;
48 }
49 
access6(S s)50 @safe S* access6(S s)
51 {
52     return &s;
53 }
54 
55 class C
56 {
57     int data;
58 
access7()59     @safe int* access7()
60     {
61         return &data;
62     }
63 }
64 
65 
66