MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test20809.d
blob0b452774245f7315b10e3677086c673477536a3c
1 /*
2 REQUIRED_ARGS:
3 TEST_OUTPUT:
4 ---
5 fail_compilation/test20809.d(114): Error: returning `this.a` escapes a reference to parameter `this`
6 fail_compilation/test20809.d(112): perhaps annotate the function with `return`
7 ---
8 */
10 // https://issues.dlang.org/show_bug.cgi?id=20809
12 #line 100
14 @safe:
16 struct S
18 @safe:
19 int a;
20 ~this()
22 a = 0;
25 ref int val()
27 return a;
31 S bar()
33 return S(2);
36 int foo()
38 return bar.val;
41 void test()
43 assert(foo() == 2);