Bug 21428 – Appending to keys of an empty associative array "cannot be interpreted at compile time"

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-11-26T13:08:50Z
Last change time
2024-12-13T19:13:03Z
Keywords
CTFE, rejects-valid
Assigned to
No Owner
Creator
Max Samukha
Moved to GitHub: dmd#19829 →

Comments

Comment #0 by maxsamukha — 2020-11-26T13:08:50Z
import std.algorithm; auto foo() { bool[string] p; return p.keys ~ "bar"; } enum a = foo; void main() { } onlineapp.d(7): Error: keys(p) ~ ["bar"] cannot be interpreted at compile time onlineapp.d(10): called from here: foo() Compiles if the array is not empty or p.keys are appended to indirectly.
Comment #1 by robert.schadek — 2024-12-13T19:13:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19829 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB