[Dlang-internal] DIP1000 discussion and testing

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Sat Dec 17 04:54:54 PST 2016


On 12/16/2016 8:43 AM, Mathias Lang wrote:
> ```
> struct Foo { int* ptr; }
>
> void main () @safe
> {
>     int* a = escape();
> }
>
> int* escape () @safe
> {
>     int i;
>     Foo f;
>     scope int** x = &f.ptr;
>     f.ptr = &i;
>
>     return bar(x);
> }
>
> int* bar ( scope int** ptr ) @safe
> {
>   return *ptr;
> }
> ```
>
> Compiles with `./src/dmd -transition=safe -dip25 test.d` on commit
> fbbfce8f6e0afb716ec96ba3dc2e82b3536cbaac (with the latest 2 P.R. merged).

https://github.com/dlang/dmd/pull/6328


More information about the Dlang-internal mailing list