Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter does not support nothrow sink delegate #10403

Open
dlangBugzillaToGithub opened this issue Jan 8, 2020 · 0 comments
Open

Formatter does not support nothrow sink delegate #10403

dlangBugzillaToGithub opened this issue Jan 8, 2020 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

andrej.mitrovich (@AndrejMitrovic) reported this on 2020-01-08T07:33:18Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=20487

Description

-----
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]
-----
@LightBender LightBender removed the P3 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants