[Issue 18711] New: Suggest to slice a static array when the called function would accept it
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Apr 3 05:20:11 UTC 2018
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 at puremagic.com
Reporter: greensunny12 at gmail.com
>From 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.
--
More information about the Digitalmars-d-bugs
mailing list