MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test22298.d
blobcdb1a3eb508368abe4d3263ad2ec9b397cec34fd
1 /*
2 REQUIRED_ARGS: -preview=dip1000
3 TEST_OUTPUT:
4 ---
5 fail_compilation/test22298.d(18): Error: scope variable `i` assigned to `p` with longer lifetime
6 fail_compilation/test22298.d(29): Error: scope variable `y` assigned to `x` with longer lifetime
7 ---
8 */
10 void g(scope void delegate(scope int*) @safe cb) @safe {
11 int x = 42;
12 cb(&x);
15 void main() @safe {
16 int* p;
17 void f(scope int* i) @safe {
18 p = i;
21 g(&f);
22 // address of x has escaped g
23 assert(*p == 42);
26 void f() @safe {
27 mixin("scope int* x;");
28 scope int* y;
29 x = y;