www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5529] New: std.system.endian for pure functions?

reply d-bugmail puremagic.com writes:
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



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: -------
Feb 05 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5529


kennytm gmail.com changed:

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



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: -------
Apr 13 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 16 2013