Thread overview
[Issue 5529] New: std.system.endian for pure functions?
Apr 13, 2011
kennytm@gmail.com
Jan 17, 2013
yebblies
February 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5529

           Summary: std.system.endian for pure functions?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2011-02-05 06:09:40 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 13, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5529


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm@gmail.com


--- Comment #1 from kennytm@gmail.com 2011-04-13 04:42:18 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5529


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


--- Comment #2 from yebblies <yebblies@gmail.com> 2013-01-17 12:33:40 EST ---
Fixed a while ago

https://github.com/D-Programming-Language/phobos/commit/57249b4378280e67b2a66be28f939c86a0dee78a

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------