Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.concurrency.initOnce does not work with -preview=nosharedaccess #9880

Open
dlangBugzillaToGithub opened this issue Nov 7, 2024 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

sludwig (@s-ludwig) reported this on 2024-11-07T10:51:58Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=24847

Description

---
import std.concurrency;
class C {}
shared C instance;
void main()
{
	auto obj = initOnce!instance(new C);
}
---

When compiling with DMD 2.109.1 and `-preview=nosharedaccess`, results in:

/dlang/dmd/linux/bin64/../../src/phobos/std/concurrency.d(2751): Error: direct access to shared `mutex` is not allowed, see `core.atomic`
/dlang/dmd/linux/bin64/../../src/phobos/std/concurrency.d(2755): Error: direct access to shared `instance` is not allowed, see `core.atomic`
/dlang/dmd/linux/bin64/../../src/phobos/std/concurrency.d(2684): Error: template instance `std.concurrency.initOnce!(instance)` error instantiating
onlineapp.d(6):        instantiated from here: `initOnce!(instance)`
@LightBender LightBender removed the P1 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants