MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test16589.d
blobdc4c5931a4f00ce0e834279d5c112f3b295fb8bd
1 /*
2 REQUIRED_ARGS: -preview=dip1000
3 TEST_OUTPUT:
4 ---
5 fail_compilation/test16589.d(26): Error: returning `&this.data` escapes a reference to parameter `this`
6 fail_compilation/test16589.d(24): perhaps annotate the function with `return`
7 fail_compilation/test16589.d(31): Error: returning `&this` escapes a reference to parameter `this`
8 fail_compilation/test16589.d(29): perhaps annotate the function with `return`
9 fail_compilation/test16589.d(37): Error: returning `&s.data` escapes a reference to parameter `s`
10 fail_compilation/test16589.d(35): perhaps annotate the parameter with `return`
11 fail_compilation/test16589.d(42): Error: returning `&s` escapes a reference to parameter `s`
12 fail_compilation/test16589.d(40): perhaps annotate the parameter with `return`
13 fail_compilation/test16589.d(47): Error: returning `&s.data` escapes a reference to parameter `s`
14 fail_compilation/test16589.d(52): Error: returning `& s` escapes a reference to parameter `s`
15 ---
18 // https://issues.dlang.org/show_bug.cgi?id=16589
20 struct S
22 int data;
24 @safe int* access1()
26 return &data;
29 @safe S* access2()
31 return &this;
35 @safe int* access3(ref S s)
37 return &s.data;
40 @safe S* access4(ref S s)
42 return &s;
45 @safe int* access5(S s)
47 return &s.data;
50 @safe S* access6(S s)
52 return &s;
55 class C
57 int data;
59 @safe int* access7()
61 return &data;