mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
30 lines
526 B
D
30 lines
526 B
D
/+
|
|
REQUIRED_ARGS: -preview=dip1000
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail24212.d(29): Error: assigning reference to local variable `n` to non-scope parameter `p` calling `fun` is not allowed in a `@safe` function
|
|
---
|
|
+/
|
|
class Base
|
|
{
|
|
@safe pure nothrow
|
|
void fun(int* p) {}
|
|
}
|
|
|
|
void test() @safe
|
|
{
|
|
int* escaped;
|
|
|
|
class Escaper : Base
|
|
{
|
|
@safe pure nothrow
|
|
override void fun(int* p)
|
|
{
|
|
escaped = p;
|
|
}
|
|
}
|
|
|
|
int n;
|
|
Base base = new Escaper;
|
|
base.fun(&n);
|
|
}
|