D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21000 - -preview=nosharedaccess precludes use of stdin,stdout,stderr
Summary: -preview=nosharedaccess precludes use of stdin,stdout,stderr
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Other
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-07-01 12:07 UTC by Bruce Carneal
Modified: 2022-10-05 02:17 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bruce Carneal 2020-07-01 12:07:07 UTC
import std.stdio;

void main() { writeln("Hello world!");

Compilation of the above with -preview=nosharedaccess fails.  The three error messages, one each for stdin, stdout and stderr, look like this:

/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d-mixin-4841(4841): Error: direct access to shared stdin is not allowed, see core.atomic


In the current stdio.d, the offending mixin is at line 4858 within the property template named "makeGlobal".

The fix may be as simple as a cast at that location.
Comment 1 Bruce Carneal 2020-07-01 12:16:25 UTC
main() needs a closing brace.
Comment 2 Dlang Bot 2022-09-09 19:12:28 UTC
@atilaneves created dlang/phobos pull request #8562 "Fix issue 21000 - allow use of std{in,out,err} with -preview=noshared…" fixing this issue:

- Fix issue 21000 - allow use of std{in,out,err} with -preview=nosharedaccess

https://github.com/dlang/phobos/pull/8562
Comment 3 Dlang Bot 2022-10-05 02:17:09 UTC
dlang/phobos pull request #8562 "Fix issue 21000 - allow use of std{in,out,err} with -preview=noshared…" was merged into master:

- 03ac553e03d2c018c7e4b050c4cb4e893bdf79dc by Atila Neves:
  Fix issue 21000 - allow use of std{in,out,err} with -preview=nosharedaccess

https://github.com/dlang/phobos/pull/8562