[Issue 14467] arr.capacity sometimes erroneously returns 0

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 19 22:43:24 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14467

--- Comment #4 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
but to rehabilitate myself a little i can tell you what was changed since
2.066. `GC.query` used to return block info regardless of the address passed,
and now it works only if base address passed. with the following patch assert
is ok again:

diff --git a/src/rt/lifetime.d b/src/rt/lifetime.d
index 23c611b..dde17af 100644
--- a/src/rt/lifetime.d
+++ b/src/rt/lifetime.d
@@ -719,7 +719,7 @@ body
     // step 1, get the block
     auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
     auto bic = isshared ? null : __getBlkInfo((*p).ptr);
-    auto info = bic ? *bic : GC.query((*p).ptr);
+    auto info = bic ? *bic : GC.query(GC.addrOf((*p).ptr));
     auto tinext = unqualify(ti.next);
     auto size = tinext.tsize;
     version (D_InlineAsm_X86)

--


More information about the Digitalmars-d-bugs mailing list