(root)/
gcc-13.2.0/
gcc/
testsuite/
gdc.test/
fail_compilation/
retscope5.d
/*
REQUIRED_ARGS: -preview=dip1000
*/

/*
TEST_OUTPUT:
---
fail_compilation/retscope5.d(5010): Error: address of variable `t` assigned to `p` with longer lifetime
---
*/

#line 5000

// https://issues.dlang.org/show_bug.cgi?id=17725

void test() @safe
{
    int* p;
    struct T {
            int a;
    }
    void escape(ref T t) @safe {
            p = &t.a; // should not compile
    }
}