[Issue 8471] std.stdio.readf should be @trusted

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 17 08:03:15 PST 2017


https://issues.dlang.org/show_bug.cgi?id=8471

--- Comment #5 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Jakub Łabaj from comment #4)
> According to Steven's blog post
> (http://dlang.org/blog/2016/09/28/how-to-write-trusted-code-in-d/) I should
> "never use @trusted on template functions that accept arbitrary types". Is
> the readf case special in this regard?

If readf calls user-defined functions (constructor, assignment) then yes that's
a problem. The smoking gun would be an unsafe unittest that passes with the
current implementation. Can you write one?

--


More information about the Digitalmars-d-bugs mailing list