[Issue 5717] 1.067 regression: appending Unicode char to string broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 10 07:16:41 PST 2011


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #5 from Don <clugdbug at yahoo.com.au> 2011-03-10 07:13:37 PST ---
It was indeed caused by the fix to bug 4389, which wasn't tight enough.  
s~= c shouldn't turn c into a dchar, if both s and c are the same type. (ie,
char[]~=char should go through unaltered). That leaves wchar[] ~ char, which I
think is inevitably a mess if c is outside the ASCII range.

expression.c, line 8593. CatAssignExp::semantic()

   {   // Append array
        e2 = e2->castTo(sc, e1->type);
        type = e1->type;
        e = this;
    }
    else if (tb1->ty == Tarray &&
        (tb1next->ty == Tchar || tb1next->ty == Twchar) &&
+        e2->type->ty != tb1next->ty &&
        e2->implicitConvTo(Type::tdchar)
       )
    {   // Append dchar to char[] or wchar[]
        e2 = e2->castTo(sc, Type::tdchar);
        type = e1->type;
        e = this;

        /* Do not allow appending wchar to char[] because if wchar happens
         * to be a surrogate pair, nothing good can result.
         */

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


More information about the Digitalmars-d-bugs mailing list