Bar.toString is typed @system
.
Thread overview |
---|
August 01, 2022 toString doesn't compile with -dip1000 switch | ||||
---|---|---|---|---|
| ||||
struct Foo() { import std.format: FormatSpec; const void toString( scope void delegate(const(char)[]) @safe sink, FormatSpec!char fmt) {} } struct Bar { import std.format: FormatSpec; const void toString( scope void delegate(const(char)[]) @safe sink, FormatSpec!char fmt) {} } @safe unittest { import std.conv:to; Foo!() foo; foo.to!string; Bar bar; bar.to!string; // 25 } # dmd d.d -dip1000 -unittest -main d.d(25) Error: @safe function d.__unittest_121_C7 cannot call @system function std.conv.to!string.to!(Bar).to /usr/lib/dmd/2.099/import/std/conv.d(221): std.conv.to!string.to! (Bar).to is declared here why is that? |
August 01, 2022 Re: toString doesn't compile with -dip1000 switch | ||||
---|---|---|---|---|
| ||||
Posted in reply to wjoe |
August 01, 2022 Re: toString doesn't compile with -dip1000 switch | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Monday, 1 August 2022 at 13:09:01 UTC, Kagamin wrote:
> Bar.toString is typed `@system`.
Even if I'd declare everything @safe: at module scope?
|
August 01, 2022 Re: toString doesn't compile with -dip1000 switch | ||||
---|---|---|---|---|
| ||||
Posted in reply to wjoe | On Monday, 1 August 2022 at 17:07:43 UTC, wjoe wrote: >On Monday, 1 August 2022 at 13:09:01 UTC, Kagamin wrote: >Bar.toString is typed Even if I'd declare everything @safe: at module scope? I wrote that on my phone and it got a bit messy...
|
Copyright © 1999-2021 by the D Language Foundation