www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9290] New: Ability to modify immutable as static array assignment is allowed when it must not

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

           Summary: Ability to modify immutable as static array assignment
                    is allowed when it must not
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: verylonglogin.reg gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-01-10
12:31:45 MSK ---
---
struct S
{ immutable int i; }

void main()
{
    S s1 = { 1 }, s2 = { 2 };
    static assert(!__traits(compiles, s1 = s2)); // ok

    S[1] sArr1 = { 1 }, sArr2 = { 2 };
    static assert(!__traits(compiles, sArr1 = s2)); // fails
    static assert(!__traits(compiles, sArr1 = sArr2)); // fails
}
---

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