Bug 17658 – Shared postblits and dtors conflict with non-shared versions

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-17T12:25:46Z
Last change time
2024-12-13T18:53:25Z
Assigned to
No Owner
Creator
Jack Stouffer
Blocks
16535
See also
https://issues.dlang.org/show_bug.cgi?id=8955, https://issues.dlang.org/show_bug.cgi?id=17970
Moved to GitHub: dmd#19283 →

Comments

Comment #0 by jack — 2017-07-17T12:25:46Z
Unlike the ctor, dtors and postblits cannot be overloaded with a shared version that gets called on shared instantiations. The main problem with this is that making any non-trivial struct work with shared is now impossible, and the user has to make a new struct that's marked with shared on the signature. ================== struct A { this(string a) {} this(string a) shared {} ~this() {} ~this() shared {} this(this) {} this(this) shared {} } void main() { shared f = A(""); } ================== Gives /d422/f152.d(7): Error: destructor f152.A.~this conflicts with destructor f152.A.~this at /d422/f152.d(6) /d422/f152.d(10): Error: function f152.A.__postblit conflicts with function f152.A.__postblit at /d422/f152.d(9)
Comment #1 by robert.schadek — 2024-12-13T18:53:25Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19283 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB