Can't put a const(char)[] into a char[]

Steven Schveighoffer schveiguy at yahoo.com
Sat Apr 21 22:34:39 UTC 2018


I just came across this. Can't believe there's not been more people 
finding this:

char[] buf = new char[100];
buf.formattedWrite("This is a number: %s", 5); // Error cannot put a 
const(char)[] into a char[]


OK, challenge accepted!

buf[0 .. myName.length] = myName[]; // Hey phobos, look, this is easy!

But no, of course -- autodecoding. >:(

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

-Steve


More information about the Digitalmars-d mailing list