Thread overview
[Issue 7313] New: the result of a 'new' expression should implicitly cast to (im)mutable
Jan 18, 2012
timon.gehr@gmx.ch
Jan 18, 2012
Jonathan M Davis
Jan 18, 2012
timon.gehr@gmx.ch
January 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7313

           Summary: the result of a 'new' expression should implicitly
                    cast to (im)mutable
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: timon.gehr@gmx.ch


--- Comment #0 from timon.gehr@gmx.ch 2012-01-18 11:20:40 PST ---
the following code should compile:
void main(){
    immutable a = new int[1];
    int[] b = new immutable(int)[1];
}

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


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com
           Platform|Other                       |All
         OS/Version|Linux                       |All


--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-01-18 13:56:46 PST ---
I can see why that would be nice with regards to primitives, but I would point out that that wouldn't work with structs or classes (or with arrays of structs or classes).

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



--- Comment #2 from timon.gehr@gmx.ch 2012-01-18 14:28:35 PST ---
It works with any type that has a pure constructor where all (unscoped) constructor arguments convert to the respective qualifier.

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