On Friday, 29 May 2015 at 07:55:55 UTC, seen wrote:
ubyte[] toBytes(T)(T from) if (!is(T == const))
{
ByteConverter!T converter;
converter.value = from;
return converter.bytes;
}
This function is incorrect: it is returning a slice (dynamic array) of a static array, which is located on the stack. The fact that it compiles without error is bug 9279 (https://issues.dlang.org/show_bug.cgi?id=9279).
