6139 – Duplicate error message on compile-time out of bounds array index

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
Add an attachment (proposed patch, testcase, etc.)

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
Comment 1 yebblies 2011年07月01日 03:48:49 UTC
https://github.com/D-Programming-Language/dmd/pull/187 


AltStyle によって変換されたページ (->オリジナル) /