[Issue 19183] DIP1000 defeated if auto used instead of scope in variable declaration with template this member function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 23 09:19:32 UTC 2019


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

--- Comment #19 from Atila Neves <atila.neves at gmail.com> ---
I can't reproduce the issue anymore. It helps that I now understand DIP1000 a
lot better than I did then. This seems to work fine:


--------------------
int* gInts;

void main() @safe {
    scope s = MyStruct();
    gInts = s.ptr;
}

struct MyStruct {
    int* ints;
    auto ptr(this This)() @safe return scope { return ints; }
}
--------------------

It lets you escape the pointer however if you replace `scope` with `auto` when
declaring `s`. In any case that'd be a different bug.

--


More information about the Digitalmars-d-bugs mailing list