[Issue 17763] [scope][DIP1000] Error: "cannot take address of scope local" while passing a slice to a scope parameter

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Aug 19 11:17:15 PDT 2017


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

ZombineDev <petar.p.kirov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |rejects-valid

--- Comment #1 from ZombineDev <petar.p.kirov at gmail.com> ---
While previous case was rejects-valid, here's a similar one where the compile
accepts invalid code:

$ cat > scope_bug2.d << DBUG
@safe:
struct Context { char[] str; }

void main()
{
    Context[1] c;
    use(c);
}

Context[] global;

void use(scope ref Context[1] c)
{
    // global = c[]; // OK - this does not compile.
    global = c;      // NG - this does compile, but it should not
                     // as it is equivalent to the one above.
}
DBUG

$ dmd -dip1000 scope_bug2.d
$ echo $?
0

--


More information about the Digitalmars-d-bugs mailing list