January 16, 2020 [Issue 20511] New: Can't format JSONValue to OutputRange due to @safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20511 Issue ID: 20511 Summary: Can't format JSONValue to OutputRange due to @safe Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: default_357-line@yahoo.de Consider the following code: --- import std.format : formattedWrite; import std.json : JSONValue; import std.range : nullSink, OutputRange, outputRangeObject; void main() { outputRangeObject!(const(char)[])(nullSink) .formattedWrite!"%s"(JSONValue.init); } --- This should compile, but it instead produces an error. This is caused by std.json.toJson being `@safe`. toJson can not be @safe, because it calls arbitrary output range code. -- |
Copyright © 1999-2021 by the D Language Foundation