On 01/12/2018 02:45 AM, Nicholas Wilson wrote:
because you don't initialise `s` instring toString () { string s; return s; }so it defaults to `string s = null;` thus giving a segfault. try `string s = "";` instead.
A null string is a perfectly fine empty string. Printing it does not lead to a segfault. And the thrown error is not a segfault.
Actually, the problem seems to be that s is not default initialized. It's garbage. And garbage usually isn't a proper string, so writeln fails. Looks like a compiler bug.
