2 REQUIRED_ARGS: -preview=dip1000
5 fail_compilation/test20245.d(14): Error: scope variable `a` may not be returned
6 fail_compilation/test20245.d(18): Error: cannot take address of `scope` parameter `x` in `@safe` function `foo`
7 fail_compilation/test20245.d(33): Error: reference to local variable `price` assigned to non-scope `this.minPrice`
11 // https://issues.dlang.org/show_bug.cgi?id=20245
12 @safe int* foo(ref int x) {
17 @safe int** foo(ref scope int* x) {
22 @safe int* foo(return ref int x) {
27 // https://issues.dlang.org/show_bug.cgi?id=21212
28 class MinPointerRecorder
31 void update(ref int price) @safe
33 minPrice = &price; // Should not compile.
39 auto r = new MinPointerRecorder;
40 () { int mp = 42; r.update(mp); } ();
41 () { ulong[1000] stomp = 13; } ();
42 auto x = *r.minPrice; // "13"