Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit bb0bce7

Browse files
authored
Merge pull request #2674 from ShigekiKarita/patch-1
Fix issue 20049 - object.destroy doesn't propagate attributes merged-on-behalf-of: Nicholas Wilson <[email protected]>
2 parents 670d0b5 + 18628c8 commit bb0bce7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/object.d

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,21 @@ nothrow @safe @nogc unittest
882882
}
883883
}
884884

885+
nothrow unittest
886+
{
887+
// Bugzilla 20049: Test to ensure proper behavior of `nothrow` destructors
888+
class C
889+
{
890+
static int dtorCount = 0;
891+
this() nothrow {}
892+
~this() nothrow { dtorCount++; }
893+
}
894+
895+
auto c = new C;
896+
destroy(c);
897+
assert(C.dtorCount == 1);
898+
}
899+
885900
/// ditto
886901
void destroy(bool initialize = true, T : U[n], U, size_t n)(ref T obj) if (!is(T == struct))
887902
{
@@ -988,7 +1003,7 @@ template _isStaticArray(T)
9881003
private
9891004
{
9901005
extern (C) Object _d_newclass(const TypeInfo_Class ci);
991-
extern (C) void rt_finalize(void *data, bool det=true);
1006+
extern (C) void rt_finalize(void *data, bool det=true) nothrow;
9921007
}
9931008

9941009
public @trusted @nogc nothrow pure extern (C) void _d_delThrowable(scope Throwable);

0 commit comments

Comments
 (0)