digitalmars.D.bugs - [Issue 24586] New: [REG 2.108] initialization of immutable arrays
- d-bugmail puremagic.com (39/39) Jun 04 https://issues.dlang.org/show_bug.cgi?id=24586
https://issues.dlang.org/show_bug.cgi?id=24586 Issue ID: 24586 Summary: [REG 2.108] initialization of immutable arrays with a system function marks the array as system Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: schveiguy gmail.com In 2.108, I started receiving deprecation messages about system variables. This bizarrely occurs on explicitly typed arrays initialized from unmarked CTFE functions, and not on inferred ones. ```d int[] arr() { return [1, 2, 3]; } static immutable x = arr(); static immutable int[] x2 = [1, 2, 3]; static immutable int[] x3 = arr(); void main() safe { int v; v = x[0]; // ok v = x2[0]; // ok v = x3[0]; // deprecation } ``` The deprecation message is: ``` Deprecation: cannot access ` system` variable `x3` in safe code ``` Marking `arr` as ` safe` fixes the problem. Using the preview switch indeed treats this as an error, so marking as rejects-valid. This does not happen for 2.107 and earlier, so this is a regression. --
Jun 04