[Bug 111] New: appending a dchar to a char[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 20 07:47:12 PDT 2006


           Summary: appending a dchar to a char[]
           Product: D
           Version: 0.154
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: lio at lunesu.com

#void main() {
#  char[] t;
#//  t ~= '我'; // Error: Can only append to dynamic arrays, not char[]
~= wchar
#  t ~= "我";
#  char[] r;
#  foreach(dchar d; t) {
#    int rel = r.length;
#    r ~= d;
#    if (d>127) assert(r.length-rel>1); // fails
#  }
#  assert(r.length == t.length); // fails

First of all: since I'm allowed to write "r ~= dchar", I should also be allowed
to do the same with a constant, '\u6211'. This probably got posted before.

The second one seems similar: it compiles without complaint, but it's not
correctly appending the 2-byte dchar to the char[].


More information about the Digitalmars-d-bugs mailing list