return scope ref outlives the scope of the argument
Eugene Wissner
belka at caraus.de
Tue Jun 25 17:24:27 UTC 2019
On Tuesday, 25 June 2019 at 07:32:58 UTC, Eugene Wissner wrote:
> struct Container
> {
> }
>
> static struct Inserter
> {
> private Container* container;
>
> private this(return scope ref Container container) @trusted
> {
> this.container = &container;
> }
>
> }
>
> auto func()()
> {
> Container container;
> return Inserter(container);
> }
>
> void main()
> {
> static assert(!is(typeof(func!())));
> }
>
> The code above compiles with dmd 2.085, but not 2.086 (with
> -preview=dip1000). What am I doing wrong?
Whatever. https://issues.dlang.org/show_bug.cgi?id=20006
More information about the Digitalmars-d-learn
mailing list