[Issue 15887] New: invalid char/wchar/dchar values are inconsistently accepted/rejected

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 6 12:12:16 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15887

          Issue ID: 15887
           Summary: invalid char/wchar/dchar values are inconsistently
                    accepted/rejected
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ag0aep6g at gmail.com

----
void main()
{
    char c = 0xFF; /* accepted */
    wchar wc = 0xFF_FF; /* accepted */
    dchar dc = 0xFF_FF_FF_FF; /* Error: cannot implicitly convert expression
(4294967295u) of type uint to dchar */

    string s = x"FF"; /* accepted */
    wstring ws = x"FF FF"w; /* Error: Outside Unicode code space */
    dstring ds = x"FF FF FF FF"d; /* Error: Outside Unicode code space */
}
----

Should all be accepted. The spec says about hex strings: "The hex data need not
form valid UTF characters." - https://dlang.org/spec/lex.html

--


More information about the Digitalmars-d-bugs mailing list