Bug 23421 – File.rawRead is @system on Windows

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2022-10-17T03:27:58Z
Last change time
2024-12-01T16:40:37Z
Assigned to
No Owner
Creator
Paul Backus
Moved to GitHub: phobos#9848 →

Comments

Comment #0 by snarwin+bugzilla — 2022-10-17T03:27:58Z
The following program compiles on Linux, but not on Windows: --- import std.stdio; void main() @safe { } private ubyte readByte(File file) @safe in(file.isOpen) { ubyte[1] buffer; return file.rawRead(buffer)[0]; } --- The error message is: -- Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. safetest ~master: building configuration "application"... Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64. safetest ~master: building configuration "application"... source\app.d(12,24): Error: `@safe` function `app.readByte` cannot call `@system` function `std.stdio.File.rawRead!ubyte.rawRead` C:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(1138,9): `std.stdio.File.rawRead!ubyte.rawRead` is declared here C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1. --- The cause is likely several calls to extern(C) functions in a version (Windows) block: https://github.com/dlang/phobos/blob/v2.100.2/std/stdio.d#L1145-L1159
Comment #1 by robert.schadek — 2024-12-01T16:40:37Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9848 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB