[Issue 18281] Compiler rejects safe code in @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 24 11:07:09 UTC 2018


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org
         Resolution|WONTFIX                     |INVALID

--- Comment #2 from Nick Treleaven <nick at geany.org> ---
anonymous4:
The following code works with -dip1000, so this is nothing to do with Turing
completeness, but this bug is still invalid:

void main() @safe
{
        string foo = "foo";
        string* p = &foo;
        string*[] arr = [&foo];
}

`p` and `arr` are inferred as scope. In the original code, there are no
initializers so dmd can't infer scope.

The compiler should mention that the assignment fails because the assignee is
not scope though.

--


More information about the Digitalmars-d-bugs mailing list