Bug 22385 – CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-13T18:54:59Z
Last change time
2021-12-14T10:34:15Z
Keywords
CTFE, pull, rejects-valid
Assigned to
No Owner
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2021-10-13T18:54:59Z
DMD 2.098.0: --- enum E:char[4]{ str="abcd" } enum x={ int[char[4]] aa; aa[E.str]=0; foreach(key,val;aa){} // error return 0; }(); --- Error: cannot cast `"abcd"` to `char[4]` at compile time called from here: `(*function () => 0)()` --- The code should compile. Workaround: `aa[cast(char[4])E.str]`
Comment #1 by dlang-bot — 2021-11-19T18:49:14Z
@lucica28 created dlang/dmd pull request #13326 "Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type" fixing this issue: - Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type - Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type - Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type https://github.com/dlang/dmd/pull/13326
Comment #2 by dlang-bot — 2021-11-30T11:00:36Z
dlang/dmd pull request #13326 "Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type" was merged into stable: - 8b1fdf5a9bba64351a578fbf4430a93a04016609 by Lucian Danescu: Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type https://github.com/dlang/dmd/pull/13326
Comment #3 by dlang-bot — 2021-12-14T10:34:15Z
dlang/dmd pull request #13421 "merge stable" was merged into master: - 128811d38a7584a0e27f427dd51131a6e3120dcd by lucica28: Fix Issue 22385 - CTFE fails to iterate over associative array previously indexed with implicit conversion to enum base type (#13326) https://github.com/dlang/dmd/pull/13421