[Issue 6988] New: char[] chars = ['à','è','ì']; should not compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 22 09:14:36 PST 2011


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

           Summary: char[] chars = ['à','è','ì']; should not compile
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at metalanguage.com> 2011-11-22 09:13:42 PST ---
unittest
{
    char[] chars = ['à','è','ì'];
    assert(chars == "àèì");
}

The assertion fails for the obvious reason there's no room in chars for the
multibyte characters. The initialization should not compile because it attempts
to truncate wide characters into meaningless bytes.

-- 
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