www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9647] New: Ignored immutable in struct literal

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

           Summary: Ignored immutable in struct literal
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-03-04 17:23:22 PST ---
Issue found by Ali Çehreli:
http://forum.dlang.org/thread/kh3dkf$22eb$1 digitalmars.com

DMD 2.063alpha accepts this code, ignoring the immutable():


struct Foo {
    int[] arr;
    this(int[] arr_) {
        this.arr = arr_;
    }
}
void main() {
    auto arr = [1];
    auto f = immutable(Foo)(arr);
    pragma(msg, typeof(f)); // Prints: Foo
    f.arr[0]++;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 04 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9647


Ali Cehreli <acehreli yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acehreli yahoo.com


--- Comment #1 from Ali Cehreli <acehreli yahoo.com> 2013-03-04 17:45:39 PST ---
Thanks bearophile...

Note that the bug disappears when the constructor is removed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 04 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9647


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies gmail.com> 2013-03-06 02:25:02 EST ---
*** This issue has been marked as a duplicate of issue 6578 ***

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