Bug 6139 – Duplicate error message on compile-time out of bounds array index
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-09T19:55:00Z
Last change time
2011-10-08T23:41:31Z
Keywords
diagnostic, patch
Assigned to
nobody
Creator
yebblies
Comments
Comment #0 by yebblies — 2011-06-09T19:55:43Z
void foo( T... )( T values ) {
int[ T.length - 1 ] a;
foreach ( i, v; values ) {
a[ i ] = [0, 1][i];
}
}
void main( ) {
foo( 1, 2, 3 );
}
Prints:
testx.d(4): Error: array index 2 is out of bounds a[0 .. 2]
testx.d(4): Error: array index 2 is out of bounds [0,1][0 .. 2]
testx.d(4): Error: array index 2 is out of bounds a[0 .. 2]
testx.d(4): Error: array index 2 is out of bounds [0,1][0 .. 2]
testx.d(9): Error: template instance testx.foo!(int,int,int) error instantiating