Bug 20907 – [DIP1000] Unittest fails when duplicated

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-08T03:02:37Z
Last change time
2021-11-29T16:08:08Z
Assigned to
No Owner
Creator
Bolpat

Comments

Comment #0 by qs.il.paperinik — 2020-06-08T03:02:37Z
Example code: https://run.dlang.io/is/upvQy9 Change the upper of the static foreach before the unittest to 1 will make it compile. Compiles fine without -dip1000 flag.
Comment #1 by dkorpel — 2021-08-10T09:43:49Z
The link is dead, please post the code in this issue.
Comment #2 by dkorpel — 2021-08-10T19:54:52Z
Nevermind, the url shortener was blocked on the network I was on. Here's the code reduced some more: ``` Lockstep!() lockstep() { return Lockstep!()(); } struct Lockstep() { int opApply(int delegate(int) callback) @system { return 0; } int opApply(int delegate(int) pure nothrow @nogc @safe callback) pure nothrow @nogc @safe { return 0; } } void foo0() { foreach (x; lockstep()) {} // OK } void foo1() { foreach (x; lockstep()) {} // FAILS } ```
Comment #3 by dkorpel — 2021-11-29T14:45:39Z
This compiles now with -preview=dip1000 since "Rework fix for attribute based opApply overloads (issue 15624) #13226": https://github.com/dlang/dmd/pull/13226
Comment #4 by dlang-bot — 2021-11-29T16:08:08Z
dlang/dmd pull request #13370 "Add opApply test case for issue 20907" was merged into master: - de2d05e6a70ddbcae1d03bd75e45755e863ca7c9 by dkorpel: Add opApply test case for issue 20907 https://github.com/dlang/dmd/pull/13370