https://issues.dlang.org/show_bug.cgi?id=21762
--- Comment #7 from [email protected] --- I ran into this again in a different context. One workaround for the compiler bug is to change the definition of object.destroy to do the work of __xdtor itself when the type has a destructor, but no __xdtor is found: ////////////////////////////////////////////////////////////////// import core.internal.lifetime : emplaceInitializer; import core.internal.traits : hasElaborateDestructor; void destroy(bool initialize = true, T)(ref T obj) if(is(T == struct)) { static if(initialize) { destroy!false(obj); emplaceInitializer(obj); } else static if(hasElaborateDestructor!T) { static if(__traits(hasMember, T, `__xdtor`) && __traits(isSame, T, __traits(parent, obj.__xdtor))) obj.__xdtor(); else { static if(__traits(hasMember, T, `__dtor`) && __traits(isSame, T, __traits(parent, obj.__dtor))) obj.__dtor(); foreach_reverse(ref objField; obj.tupleof) destroy!false(objField); } } } ////////////////////////////////////////////////////////////////// Should I submit a druntime pull request for this? --
