www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15887] New: invalid char/wchar/dchar values are

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 puremagic.com
          Reporter: ag0aep6g 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

--
Apr 06 2016