[Issue 23421] New: File.rawRead is @system on Windows
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 17 03:27:58 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23421
Issue ID: 23421
Summary: File.rawRead is @system on Windows
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
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
--
More information about the Digitalmars-d-bugs
mailing list