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

          Issue ID: 18281
           Summary: Compiler rejects safe code in @safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: slavo5...@yahoo.com

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

onlineapp.d(6): Error: cannot take address of local foo in @safe function main

https://run.dlang.io/is/ecYAKZ

There is no escaping reference, so I don't see why the compiler is rejecting
this code.

--

Reply via email to