Bug 5529 – std.system.endian for pure functions?

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-02-05T06:09:00Z
Last change time
2013-01-16T17:33:40Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-02-05T06:09:40Z
This little D2 program: import std.system: endian; pure void main() { auto e = endian; } DMD 2.051 shows the errors: test.d(3): Error: pure function 'main' cannot access mutable static data 'endian' test.d(3): Error: pure function 'main' cannot access mutable static data 'endian' Like __ctfe, I'd like to use std.system.endian in pure functions too.
Comment #1 by kennytm — 2011-04-13T04:42:18Z
A simple patch is to replace that 'const' with 'immutable'. diff --git a/std/system.d b/std/system.d index 8b205cb..862e99f 100644 --- a/std/system.d +++ b/std/system.d @@ -18,7 +18,7 @@ */ module std.system; -const +immutable { // Operating system family
Comment #2 by yebblies — 2013-01-16T17:33:40Z