MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail20108.d
blob15845e1d2fcc3f6769f4fec93db102d6f45c5c14
1 // REQUIRED_ARGS: -preview=dip1000
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail20108.d(15): Error: address of variable `y` assigned to `x` with longer lifetime
6 fail_compilation/fail20108.d(16): Error: scope parameter `x` may not be returned
7 fail_compilation/fail20108.d(23): Error: address of variable `y` assigned to `x` with longer lifetime
8 fail_compilation/fail20108.d(24): Error: scope variable `x` may not be returned
9 ---
12 @safe auto test(scope int* x)
14 int y = 69;
15 x = &y; //bad
16 return x;
19 @safe auto test2()
21 scope int* x;
22 int y = 69;
23 x = &y; //bad
24 return x;
27 void main()
29 auto y = test(null);
30 auto z = test2();