mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
25 lines
429 B
D
25 lines
429 B
D
/*
|
|
REQUIRED_ARGS: -preview=dip1000
|
|
*/
|
|
|
|
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/retscope5.d(5010): Error: assigning address of variable `t` to `p` with longer lifetime is not allowed in a `@safe` function
|
|
---
|
|
*/
|
|
|
|
#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
|
|
}
|
|
}
|