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: [email protected]
Reporter: [email protected]
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.
--