~~~char2.d
void main ()
{
   import std.stdio;
   import std.conv;
   char [2] win = [0, 'X'];
   auto ne = new Exception ("A " ~ win.to!string ~ " B");
   try throw ne;
   catch (Exception e)
      writeln ("exception caught: e.msg = <", e.msg, ">");
   throw ne;
}
~~~

Output:

exception caught: e.msg = <A X B>
object.Exception@char2.d(6): A              <--- truncated at \0
[...]

$ ./char2 | hexdump -c
0000000 e x c e p t i o n c a u g h t 0000010 : e . m s g = < A \0 X
0000020   B   >  \n

$ ./char2 2>&1 1>/dev/null |hexdump -c
0000000 o b j e c t . E x c e p t i o n 0000010 @ c h a r 2 . d ( 6 ) : A \n 0000020 - - - - - - - - - - - - - - - -
[...]

Shall I file a bug?

Reply via email to