www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15882] New: writeln on a bad dstring triggering assert(0) in

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

          Issue ID: 15882
           Summary: writeln on a bad dstring triggering assert(0) in
                    std.utf.toUTF8
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: erikas.aubade gmail.com

So in trying to pass a UTF32 string from C++ to D, i think I've stumbled upon
an issue in phobos. If the bad dstring is placed in a struct, and the struct
converted to string, it returns the value
x"8DA0000 51B5A8 67 69 74 65 63 68 20 57 69 6E 67 4D 61 6E
 20 53 74 72 69 6B 65 20 46 6F 72 63 65 20 33 44 20 55 53 42"d, but if I try to
pass the bad dstring to writeln, it triggers the assert(0) at the end of
std.utf.toUTF8()

(It's tricky to make a test snippet to send with this bug, because dmd will
reject the string as bad unicode, so hopefully the literal is enough.)

--
Apr 05 2016