Issue 20487 - Formatter does not support nothrow sink delegate
Summary: Formatter does not support nothrow sink delegate
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-08 07:33 UTC by Andrej Mitrovic
Modified: 2024-12-01 16:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2020-01-08 07:33:18 UTC
-----
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]
-----
Comment 1 dlangBugzillaToGithub 2024-12-01 16:36:12 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10403

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB