D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6644 - std.stdio write/writef(ln) are not @trusted
Summary: std.stdio write/writef(ln) are not @trusted
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: Blake Anderton
URL:
Keywords: pull, safe
Depends on:
Blocks:
 
Reported: 2011-09-11 09:49 UTC by Dmitry Olshansky
Modified: 2014-07-30 17:05 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dmitry Olshansky 2011-09-11 09:49:00 UTC
Surely @safe code should be able to write/read data via File.
Test case:

import std.stdio;

@safe void f()
{
    writeln("Hello!");
}

dmd output:
  
Error: safe function 'f' cannot call system function 'writeln'

This is on dmd 2.055 release.
Comment 1 anonymous4 2014-06-04 13:59:21 UTC
writeln will call toString on arguments, which may not be trusted.
Comment 4 github-bugzilla 2014-07-30 17:05:45 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/72aa8a9dca85fb03fdaaea74f1ca3303171caaeb
Merge pull request #2233 from rbanderton/fix-writeln-inference

Fix Issue 6644 - std.stdio write/writef(ln) are not @trusted