@@ -920,7 +920,7 @@ extern (C) private pure @system @nogc nothrow
920920 pragma (mangle, " free" ) void fakePureFree(void * ptr);
921921}
922922
923- extern (C ) private @system nothrow
923+ extern (C ) private @system nothrow @nogc
924924{
925925 pragma (mangle, " _d_delinterface" ) void _d_delinterface(void ** );
926926 pragma (mangle, " _d_delclass" ) void _d_delclass(Object * );
@@ -930,22 +930,17 @@ extern(C) private @system nothrow
930930}
931931
932932/**
933- The `delete` keyword allowed to free GC-allocated memory.
934- As this is inherently not `@safe`, it has been deprecated.
935- This function has been added to provide an easy transition from `delete`.
936- It performs the same functionality as `delete`.
937-
938- Note: Users should prefer $(REF destroy, object)` to explicitly finalize objects,
939- and only resort to $(REF __delete, core,memory) when $(REF destroy, object)
940- would not be a feasible option.
933+ Destroys and then deallocates the object.
941934
942935In detail, `__delete(x)` returns with no effect if `x` is `null`. Otherwise, it
943936performs the following actions in sequence:
944937$(UL
945938 $(LI
946- Calls `.object.destroy(x)` (if `x` is a class or interface object) or
947- `(*x).__xdtor()` (if `x` is pointer to a struct and a custom destructor exists) to destroy the referred entity.
948- Arrays of structs with a custom destructor call `x.__xdtor()` for each element in the array.
939+ Calls the destructor `~this()` for the object referred to by `x`
940+ (if `x` is a class or interface reference) or
941+ for the object pointed to by `x` (if `x` is a pointer to a `struct`).
942+ Arrays of structs call the destructor, if defined, for each element in the array.
943+ If no destructor is defined, this step has no effect.
949944 )
950945 $(LI
951946 Frees the memory allocated for `x`. If `x` is a reference to a class
@@ -961,15 +956,26 @@ $(UL
961956 )
962957)
963958
959+ Note: Users should prefer $(REF destroy, object)` to explicitly finalize objects,
960+ and only resort to $(REF __delete, core,memory) when $(REF destroy, object)
961+ wouldn't be a feasible option.
962+
964963Params:
965964 x = aggregate object that should be destroyed
966965
967966See_Also: $(REF destroy, object), $(REF free, core,GC)
967+
968+ History:
969+
970+ The `delete` keyword allowed to free GC-allocated memory.
971+ As this is inherently not `@safe`, it has been deprecated.
972+ This function has been added to provide an easy transition from `delete`.
973+ It performs the same functionality as the former `delete` keyword.
968974*/
969975void __delete (T)(ref T x) @system
970976{
971977 static void _destructRecurse (S)(ref S s)
972- if (is (S == struct ))
978+ if (is (S == struct ))
973979 {
974980 static if (__traits(hasMember, S, " __xdtor" ) &&
975981 // Bugzilla 14746: Check that it's the exact member of S.
0 commit comments