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