digitalmars.D.bugs - [Issue 24316] New: Allow CTFE access to immutable variable through
- d-bugmail puremagic.com (30/30) Jan 02 https://issues.dlang.org/show_bug.cgi?id=24316
https://issues.dlang.org/show_bug.cgi?id=24316 Issue ID: 24316 Summary: Allow CTFE access to immutable variable through pointer Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: tim.dlang t-online.de The following code currently does not compile: ``` struct S { int i; } int f(immutable S *s) { return s.i; } immutable S globalS = S(5); static assert (f(&globalS) == 5); ``` DMD produces the following error: Error: cannot dereference pointer to static variable `globalS` at compile time --
Jan 02