And this segfaults (on Linux):
void main() @safe
{
auto s = const(S)("abcd");
foo(s);
}
I'd call it a clear bug. Most obvious fix would be to require
const destructor if non-default destructor is present AND
immutable/const instance is attempted to be created.