Summary: to!() can  not convert from wide characters to char
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos

--- Comment #0 from Marcin Kuszczak <> 2010-10-08 01:03:34 PDT 
Test case:

void main() {
    //Instantiation error
    dchar from0 = 'A';
    char to0 = to!(char)(from0);

    //Instantiation error
    wchar from1 = 'A';
    char to1 = to!(char)(from1);

    char from2 = 'A';
    char to2 = to!(char)(from2);

    char from3 = 'A';
    wchar to3 = to!(wchar)(from3);

    char from4 = 'A';
    dchar to4 = to!(dchar)(from4);

It's interesting case as failing conversions should not always succeed (e.g.
when wchar/dchar can not be coded in one byte), while in many cases they are
perfectly valid.

I am starting thinking that assuming that strings/chars are just arrays is
quite a big mistake in D design: it introduces a lot of corner cases.

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

Reply via email to