[Issue 20901] arrays confuse static foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 9 23:38:19 UTC 2020


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

--- Comment #2 from Bolpat <qs.il.paperinik at gmail.com> ---
I reduced that issue from a much larger code and was happy to push it under 50
lines of code.

Basically, what would have to happen is this:

// At compile-time:
S tmp;
enum value1 = tmp.front.deepcopy; // Note: enum
tmp.popFront();
enum value2 = tmp.front.deppcopy; // Note: enum
tmp.popFront();

// Happens at run-time:
writeln(value1);
writeln(value2);

I cannot imagine a situation where someone relying on a non-deep copy would not
accept that this is not how static foreach works. Everything that is not a deep
copy is plainly wrong.

--


More information about the Digitalmars-d-bugs mailing list