Fix out of bounds sequence index error

This commit is contained in:
Nick Treleaven 2024-05-03 10:52:21 +01:00
parent b84fa4709f
commit 932ec7a37c
3 changed files with 3 additions and 3 deletions

View file

@ -10089,7 +10089,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
if (length <= index)
{
error(exp.loc, "array index `[%llu]` is outside array bounds `[0 .. %llu]`", index, cast(ulong)length);
error(exp.loc, "sequence index `[%llu]` is outside bounds `[0 .. %llu]`", index, cast(ulong)length);
return setError();
}
Expression e;

View file

@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail125.d(15): Error: array index `[2]` is outside array bounds `[0 .. 2]`
fail_compilation/fail125.d(15): Error: sequence index `[2]` is outside bounds `[0 .. 2]`
fail_compilation/fail125.d(18): Error: template instance `fail125.main.recMove!(1, a, b)` error instantiating
fail_compilation/fail125.d(25): instantiated from here: `recMove!(0, a, b)`
---

View file

@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice12539.d(15): Error: array index `[0]` is outside array bounds `[0 .. 0]`
fail_compilation/ice12539.d(15): Error: sequence index `[0]` is outside bounds `[0 .. 0]`
---
*/