[Issue 14699] ICE: segfaults on array with zero size

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 14 09:26:45 PDT 2015


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

--- Comment #5 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
or a patch for those who prefers `ubyte[0]` to be valid (phobos using such
thing, hehe):

diff --git a/src/todt.c b/src/todt.c
index 8ae752f..101d0bb 100644
--- a/src/todt.c
+++ b/src/todt.c
@@ -810,7 +810,7 @@ dt_t **toDtElem(TypeSArray *tsa, dt_t **pdt, Expression *e)
             len /= ((StringExp *)e)->len;
         if (e->op == TOKarrayliteral)
             len /= ((ArrayLiteralExp *)e)->elements->dim;
-        pdt = dtrepeat(pdt, *pdt, len - 1);
+        pdt = dtrepeat(pdt, *pdt, (len ? len - 1 : 0));
     }
     return pdt;
 }

--


More information about the Digitalmars-d-bugs mailing list