From a1fb3915f562428741324ac5b319d9316fb57231 Mon Sep 17 00:00:00 2001 From: Nemanja Boric <4burgos@gmail.com> Date: Sat, 13 May 2017 11:36:31 +0200 Subject: [PATCH] Fix issue 9275: Add test for removeRoot Issue 9275 describes the runtime crashing on the invalid pointer passed to removeRoot, instead of documented no-op. This has been fixed in the meantime, so unittest is added as a guarantee that it stays so. --- src/gc/impl/conservative/gc.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gc/impl/conservative/gc.d b/src/gc/impl/conservative/gc.d index fe1ca5f858..10726554a0 100644 --- a/src/gc/impl/conservative/gc.d +++ b/src/gc/impl/conservative/gc.d @@ -3368,3 +3368,12 @@ unittest assert(thrown); */ } + +unittest +{ + import core.memory; + + // https://issues.dlang.org/show_bug.cgi?id=9275 + GC.removeRoot(null); + GC.removeRoot(cast(void*)13); +}