https://issues.dlang.org/show_bug.cgi?id=22177
Stanislav Blinov <stanislav.bli...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stanislav.bli...@gmail.com --- Comment #3 from Stanislav Blinov <stanislav.bli...@gmail.com> --- I think the language should specify (as in, explicitly state in the spec) the expected state of an object in case its ctor throws. IMO it should be the user's job to leave their objects in a destructible state. Perhaps something like: "If a constructor throws an exception, the object MAY still be destructed. Therefore, constructors should always leave objects in a destructible state." Pseudo-code for emplace is: emplaceInitializer(ptr); constructAt(ptr, args); Thus it makes little sense to write the initializer again. User was given a piece of memory, it's theirs now to keep tidy. It follows then that it should be the user's responsibility to maintain exception safety in their ctors. An outlier here is emplacement of arrays, where it does make sense to write .init into the remainder of array if an exception was thrown, as that *is* assumed to contain garbage state. Overwriting partially-constructed state with .init can potentially be problematic sine can cause resource leaks. --