[Issue 4494] ICE(cod1.c) Array literal filled with results of void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 14 04:40:27 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4494



--- Comment #4 from Iain Buclaw <ibuclaw at ubuntu.com> 2011-04-14 04:36:55 PDT ---
Oops, previous patch didn't take into account that empty '[]' array literals
are allowed to be void.

diff --git a/src/expression.c b/src/expression.c
index 9d116b9..1e68ce7 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -3197,6 +3197,9 @@ Expression *ArrayLiteralExp::semantic(Scope *sc)
     Type *t0;
     elements = arrayExpressionToCommonType(sc, elements, &t0);

+    if (elements->dim > 0 && t0->ty == Tvoid)
+        error("array literal %s has no value", toChars());
+
     type = t0->arrayOf();
     //type = new TypeSArray(t0, new IntegerExp(elements->dim));
     type = type->semantic(loc, sc);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list