digitalmars.D.bugs - [Issue 18711] New: Suggest to slice a static array when the called
- d-bugmail puremagic.com (28/29) Apr 02 2018 https://issues.dlang.org/show_bug.cgi?id=18711
https://issues.dlang.org/show_bug.cgi?id=18711 Issue ID: 18711 Summary: Suggest to slice a static array when the called function would accept it Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: diagnostic Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: greensunny12 gmail.comFrom the NG(https://forum.dlang.org/post/migoytwwjmzuzmxsuqbr forum.dlang.org). The following correctly errors: wchar[10] buffer; toUTF8(buffer); However, the error message is a bit cryptic for newcomers: Error: template `std.utf.toUTF8` cannot deduce function from argument types `!()(wchar[10])`, candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/utf.d(2713): `std.utf.toUTF8(S)(S s) if (isInputRange!S && !isInfinite!S && isSomeChar!(ElementEncodingType!S))` DMD could detect that toUTF8 would accept `buffer[]` and could suggest this to the user. --
Apr 02 2018