Skip to content

Commit

Permalink
merge D2 pull 104
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 12, 2011
1 parent b937e57 commit 1157ccb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,9 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)
dim = dim->optimize(WANTvalue);
dinteger_t d2 = dim->toInteger();

if (dim->op == TOKerror)
goto Lerror;

if (d1 != d2)
goto Loverflow;

Expand All @@ -1916,7 +1919,7 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)
{
Loverflow:
error(loc, "index %jd overflow for static array", d1);
dim = new IntegerExp(0, 1, tsize_t);
goto Lerror;
}
}
}
Expand All @@ -1930,20 +1933,24 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)

if (d >= tt->arguments->dim)
{ error(loc, "tuple index %ju exceeds %u", d, tt->arguments->dim);
return Type::terror;
goto Lerror;
}
Parameter *arg = (Parameter *)tt->arguments->data[(size_t)d];
return arg->type;
}
case Tfunction:
case Tnone:
error(loc, "can't have array of %s", tbn->toChars());
tbn = next = tint32;
break;
goto Lerror;
}
if (tbn->isscope())
error(loc, "cannot have array of auto %s", tbn->toChars());
{ error(loc, "cannot have array of auto %s", tbn->toChars());
goto Lerror;
}
return merge();

Lerror:
return Type::terror;
}

void TypeSArray::toDecoBuffer(OutBuffer *buf)
Expand Down

0 comments on commit 1157ccb

Please sign in to comment.