January 08, 2020 [Issue 20487] New: Formatter does not support nothrow sink delegate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20487 Issue ID: 20487 Summary: Formatter does not support nothrow sink delegate Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: andrej.mitrovich@gmail.com ----- module test; import std.stdio; struct S { public void toString (scope void delegate(scope const(char)[]) @safe nothrow sink) @safe { sink("output"); } } void main() { S s; writeln(s); } ----- $ dmd test.d ----- /Library/D/dmd/src/phobos/std/format.d(3962): Error: function `test.S.toString(scope void delegate(scope const(char)[]) nothrow @safe sink)` is not callable using argument types `(void delegate(scope const(char)[] s) @safe)` /Library/D/dmd/src/phobos/std/format.d(3962): cannot pass argument `__lambda4` of type `void delegate(scope const(char)[] s) @safe` to parameter `scope void delegate(scope const(char)[]) nothrow @safe sink` /Library/D/dmd/src/phobos/std/format.d(4342): Error: template instance `std.format.formatObject!(LockingTextWriter, S, char)` error instantiating /Library/D/dmd/src/phobos/std/format.d(1854): instantiated from here: `formatValueImpl!(LockingTextWriter, S, char)` /Library/D/dmd/src/phobos/std/format.d(575): instantiated from here: `formatValue!(LockingTextWriter, S, char)` /Library/D/dmd/src/phobos/std/stdio.d(1506): instantiated from here: `formattedWrite!(LockingTextWriter, char, S)` /Library/D/dmd/src/phobos/std/stdio.d(3863): instantiated from here: `write!(S, char)` test.d(14): instantiated from here: `writeln!(S)` Failed: ["/Library/D/dmd/bin/dmd", "-g", "-unittest", "-v", "-o-", "test.d", "-I."] [Finished in 0.7s] ----- -- |
Copyright © 1999-2021 by the D Language Foundation