Summary: std.array.back does not work correctly for wchar-based
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from Steven Schveighoffer <> 2010-11-24 
05:11:09 PST ---
In std.array, back() is the same for both char[] based and wchar[] based
arrays, but wchar[] based arrays are encoded differently than char[] based
ones.  It appears the back() function works in most cases, but fails on a few.

Here is an example (thank you to Stephan):

import std.array;
import std.conv;

void main() {
    dchar c = cast(dchar) 0x10000;
    auto ws = to!wstring(c);
    assert(ws.length == 2);            // decoded as surrogate pair
    assert(ws.back == c);              // fails with decoding error

This should be added as a unit test, and back(wstring) should get its own

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to