digitalmars.D.bugs - [Issue 18412] New: [REG2.077.0] immutable array in library becomes
- d-bugmail puremagic.com (42/42) Feb 09 2018 https://issues.dlang.org/show_bug.cgi?id=18412
https://issues.dlang.org/show_bug.cgi?id=18412 Issue ID: 18412 Summary: [REG2.077.0] immutable array in library becomes null when referenced in static constructor Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: wrong-code Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: ag0aep6g gmail.com Spin-off from issue 18403. m1.d: ---- import m2: f; void main() { f(); } ---- m2.d: ---- static this() { auto k = keywords; } immutable int[] keywords = [42]; void f() { assert(keywords.ptr !is null); /* fails; should pass */ } ---- Compile and run (Windows via Wine, DMD32 D Compiler v2.077.0): ---- dmd -lib m2.d dmd m1.d m2.lib ./m1.exe ---- Works with 2.076.1. Works on Linux. Works when the array is mutable. Works when the array is declared before the static constructor. --
Feb 09 2018