digitalmars.D.bugs - [Issue 18790] New: can't put a const(char)[] into a char[]
- d-bugmail puremagic.com (23/23) Apr 21 2018 https://issues.dlang.org/show_bug.cgi?id=18790
https://issues.dlang.org/show_bug.cgi?id=18790 Issue ID: 18790 Summary: can't put a const(char)[] into a char[] Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: schveiguy yahoo.com The most basic string output range is char[]. Why can't I put a string in there? auto buf = new char[100]; put(buf, "hello"); // static assert: "Cannot put a string into a char[]." I found this because I'm trying to write to a stack buffer string to use later using formattedWrite. The answer to my question is (as usual) auto-decoding. ugh. At the very least, the message should be clearer (obviously, we can put a string into a char[]!). --
Apr 21 2018