digitalmars.D.bugs - [Issue 24425] New: standalone attribute should be usable on
- d-bugmail puremagic.com (32/32) Feb 29 https://issues.dlang.org/show_bug.cgi?id=24425
https://issues.dlang.org/show_bug.cgi?id=24425 Issue ID: 24425 Summary: standalone attribute should be usable on thread-local static constructors Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: schveiguy gmail.com This is a valid use of standalone constructors and should be allowed: ```d import core.attribute; int *foo; standlone system static this() { foo = new int(10); } ``` Yet, the compiler doesn't allow this usage. I'm unsure whether the compiler needs to do anything fancy here. There is an `MIstandalone` flag, which means all shared *and* thread-local static ctors of a module are standalone. And there is also an `ictor` function pointer which appears to be independent construction for a module. I'm not sure how each is used, but I would imagine constructing a "dummy" moduleinfo that contains only standalone ctors/dtors (by using the MIstandalone flag) is possible whenever needed. I know that druntime already would handle this case properly. --
Feb 29