Skip to content

Commit

Permalink
Merge pull request #100 from yebblies/issue4170
Browse files Browse the repository at this point in the history
Issue 4170 - Missing line number on compile-time array index
  • Loading branch information
WalterBright committed Jun 9, 2011
2 parents 9aae5c4 + 208c4ee commit 84f0bcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/constfold.c
Expand Up @@ -1229,7 +1229,7 @@ Expression *Index(Type *type, Expression *e1, Expression *e2)
uinteger_t i = e2->toInteger();

if (i >= length)
{ e2->error("array index %ju is out of bounds %s[0 .. %ju]", i, e1->toChars(), length);
{ e1->error("array index %ju is out of bounds %s[0 .. %ju]", i, e1->toChars(), length);
}
else if (e1->op == TOKarrayliteral)
{ ArrayLiteralExp *ale = (ArrayLiteralExp *)e1;
Expand All @@ -1246,7 +1246,7 @@ Expression *Index(Type *type, Expression *e1, Expression *e2)
if (e1->op == TOKarrayliteral)
{ ArrayLiteralExp *ale = (ArrayLiteralExp *)e1;
if (i >= ale->elements->dim)
{ e2->error("array index %ju is out of bounds %s[0 .. %u]", i, e1->toChars(), ale->elements->dim);
{ e1->error("array index %ju is out of bounds %s[0 .. %u]", i, e1->toChars(), ale->elements->dim);
}
else
{ e = (Expression *)ale->elements->data[i];
Expand Down

0 comments on commit 84f0bcb

Please sign in to comment.