Bug 12004 – shared ~this() should not exist

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-26T10:28:00Z
Last change time
2016-02-12T17:32:10Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
Marco.Leise

Comments

Comment #0 by Marco.Leise — 2014-01-26T10:28:34Z
When using shared structs, the compiler asks for a shared ~this() which should not exist in the language at all. The destructor for these value types must be run when all thread that could reference it have finished and only the owner thread is left. It is a logical error to have a destructor run in a "shared" environment. I keyworded this as rejects-valid, since I expect the following to work (with the scope being either global or function stack): ------------ struct Foo { ~this() {} } shared Foo; ------------- Warning: non-shared method Foo.~this is not callable using a shared object
Comment #1 by r9shackleford — 2016-02-12T17:32:10Z
*** This issue has been marked as a duplicate of issue 8295 ***