D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6139 - Duplicate error message on compile-time out of bounds array index
Summary: Duplicate error message on compile-time out of bounds array index
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 trivial
Assignee: No Owner
URL:
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2011-06-09 19:55 UTC by yebblies
Modified: 2011-10-08 23:41 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description yebblies 2011-06-09 19:55:43 UTC
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