Thread overview
[Issue 6988] New: char[] chars = ['à','è','ì']; should not compile
[Issue 6988] char a = 'ä'; should not compile
Nov 22, 2011
Trass3r
Feb 01, 2012
yebblies
November 22, 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@puremagic.com
        ReportedBy: andrei@metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei@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: -------
November 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6988


Trass3r <mrmocool@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, diagnostic
                 CC|                            |mrmocool@gmx.de
            Summary|char[] chars =              |char a = 'ä'; should not
                   |['à','è','ì']; should not   |compile
                   |compile                     |


--- Comment #1 from Trass3r <mrmocool@gmx.de> 2011-11-22 12:19:23 PST ---
It's more general:

void main()
{
    char a = 'ä'; // compiles fine
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6988


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies@gmail.com> 2012-02-01 14:48:05 EST ---
*** This issue has been marked as a duplicate of issue 6458 ***

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