www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3281] New: append returned struct to array: Internal error: ../ztc/cod1.c 168

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

           Summary: append returned struct to array: Internal error:
                    ../ztc/cod1.c 168
           Product: D
           Version: 2.031
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: peng2cheng2 yahoo.com


import std.stdio;

struct S {string s; this(string x){s=x;}}

immutable(S) mkS(){
  return S("mks hi");
}

void main(char[][] args) {
  immutable(S) s = mkS();
  immutable(S)[] ss;
  ss ~= S("plain hi");
  ss ~= cast(immutable(S)) S("plain hi");
  //ss ~=  mkS(); // --> "Internal error: ../ztc/cod1.c 1684"
  writeln(s.s, ", ", ss[0].s);
}


I think (hope?) this is all valid code. I.e.,

  ss ~= S("Hi"); //should be ok
  ss.length = ss.length + 1;
  ss[$-1] = S("plain hi"); //should fail to compile (as it indeed does)

In any case there is an ICE.




Error: ss[0] isn't mutable
Error: ss[0] isn't mutable

  //ss[0] = S("fail"); --> Error: ss[0] isn't mutable

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 02 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3281






Good news: This is already fixed in DMD 2.032, which will hopefully be released
tomorrow.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 02 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3281


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED





13:46:02 PDT ---
Fixed dmd 2.032

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