June 12, 2024 [Issue 24602] New: Internal compiler error static initialization of set | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24602 Issue ID: 24602 Summary: Internal compiler error static initialization of set Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: sahan.h.fernando@gmail.com The following code fails to compile on dmd, with the error message below. Code: ``` class Set { bool[string] s; } Set newSet(string[] values) { auto s = new Set(); foreach (v; values) { s.s[v] = true; } return s; } class Bar { Set x = newSet(["a", "b"]); } void main() {} ``` Compile command: ``` $ dmd repro.d ``` Error message: ``` repro.d(8): Error: internal compiler error: failed to detect static initialization of associative array ``` I hit this on `DMD64 D Compiler v2.108.1`, as packaged by the arch linux maintainers (Looking through the build files for the package at https://gitlab.archlinux.org/archlinux/packaging/packages/dmd/-/blob/1-2.108.1-1/PKGBUILD?ref_type=tags, it doesn't seem like there were any patches applied by them, so I believe this must be a bug in the compiler). -- |
Copyright © 1999-2021 by the D Language Foundation