[Issue 17730] [scope][dip1000] std.algorithm.move escapes scope variable in @safe code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 23 19:50:27 UTC 2017


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

Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3
                 CC|                            |code at dawg.eu
            Summary|[scope][dip1000]            |[scope][dip1000]
                   |std.algorithm.move can      |std.algorithm.move escapes
                   |escape references to scope  |scope variable in @safe
                   |classes                     |code

--- Comment #2 from Martin Nowak <code at dawg.eu> ---
cat > bug.d << CODE
import std.algorithm : move;

int* escapeLocal() @safe
{
    int var;
    scope int* p = &var;
    return move(p); // should error
}

void test() @safe
{
    auto p = escapeLocal;
}
CODE
dmd -c -o- -dip1000 bug.d
----

Reduced example not specific to scope classes, seems like move should take it's
argument as return scope, no?

--


More information about the Digitalmars-d-bugs mailing list