Thread overview
[Issue 16454] Return in the body of a foreach in a constructor backed by opApply corrupts the object
Aug 31, 2016
ag0aep6g@gmail.com
Dec 17, 2022
Iain Buclaw
August 31, 2016
https://issues.dlang.org/show_bug.cgi?id=16454

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g@gmail.com
           Hardware|x86_64                      |All
                 OS|Mac OS X                    |All

--- Comment #1 from ag0aep6g@gmail.com ---
Slightly reduced:

----
struct OpApply {
    int opApply(int delegate(int) cb) { return 0; }
}

struct Bolinha {
    int a = 0;
    this(int dummy) {
        OpApply moviadao;
        foreach(int b; moviadao) return;
    }
}

void main() {
    import std.stdio;
    writeln(Bolinha(0).a);
}
----

Also fails on Linux and Windows (wine).

--
October 26, 2021
https://issues.dlang.org/show_bug.cgi?id=16454

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg

--- Comment #2 from moonlightsentinel@disroot.org ---
Works reliably since 2.094.1 according to run.dlang.io / local tests

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16454

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
December 13
https://issues.dlang.org/show_bug.cgi?id=16454

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19184

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--