September 09 [Issue 24754] New: cannot take address of a member array in a ref foreach | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24754 Issue ID: 24754 Summary: cannot take address of a member array in a ref foreach Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: contact@lsferreira.net The following code should compile: ``` struct Foo { int[] foo; @safe void foobar() { int* f; foreach(ref e; foo) f = &e; } } void main() { Foo foo; foo.foobar(); } ``` Shouldn't yield: ``` Up to 2.078.3: Failure with output: onlineapp.d(10): Error: cannot take address of local e in @safe function foobar Since 2.079.1: Failure with output: onlineapp.d(10): Error: cannot take address of local `e` in `@safe` function `foobar` ``` -- |
Copyright © 1999-2021 by the D Language Foundation