www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12248] New: Static arrays have no tail const

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12248

           Summary: Static arrays have no tail const
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com



12:31:51 EET ---
immutable(ubyte)[4] and immutable(ubyte[4]) are the same type. As a
consequence, this won't compile:

alias immutable(ubyte)[40] Hash;
Hash[] hashes;
hashes.sort;

.sort (std.algorithm.sort too) does not compile, as it thinks the array
contents is immutable.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12248




12:34:34 EET ---
Wrapping the array in a struct causes .sort to work, but not
std.algorithm.sort. Now I'm not sure what the bug is.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12248


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc




 immutable(ubyte)[4] and immutable(ubyte[4]) are the same type. As a
 consequence, this won't compile:
 
 alias immutable(ubyte)[40] Hash;
 Hash[] hashes;
 hashes.sort;
 
 .sort (std.algorithm.sort too) does not compile, as it thinks the array
 contents is immutable.
This is expected. The values of the array are immutable, so you can't swap them. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12248





 Wrapping the array in a struct causes .sort to work, but not
 std.algorithm.sort. Now I'm not sure what the bug is.
Please show the code that shows the difference. Also, never use the built-in sort, it's quite buggy, and it's going to be deprecated, hopefully warned-against in dmd 2.066. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12248


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID





 Please show the code that shows the difference.
I have found it, filed as Issue 12253 I close this Issue because I think it's not a bug. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2014