[Issue 6297] New: cast() does not remove const or immutable on arrays and pointers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 12 11:51:23 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6297

           Summary: cast() does not remove const or immutable on arrays
                    and pointers
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: schveiguy at yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-07-12 11:46:14 PDT ---
cast() is supposed to remove all attributes from a type, but in the case of
arrays, it does nothing to the tail.

I think cast() should remove even the tail.

Note that arrays *already* implicitly cast to their tail versions.  i.e.:

const(T[]) implicitly casts to const(T)[]
immutable(T[]) implicitily casts to immutable(T)[]

so to have:

cast()const(T[]) result in const(T)[] serves no purpose, I need no cast there.

The same goes for pointers, and if they are ever implemented, tail-const object
references.

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


More information about the Digitalmars-d-bugs mailing list