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