[Issue 12463] New: Incorrect error: mismatched array lengths, X and 1
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 25 07:18:19 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12463
Summary: Incorrect error: mismatched array lengths, X and 1
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: kekeniro2 at yahoo.co.jp
--- Comment #0 from kekeniro2 at yahoo.co.jp 2014-03-25 07:18:14 PDT ---
The following initliazations of static arrays are all valid.
void main()
{
int[4] ary4_4 = [1,2,3,4]; // OK
int[4] ary4_1 = [1]; // NG line(4)
int[10] ary0 = [0:123]; // NG line(6)
int[10] ary01 = [0:123, 1:234]; // NG line(7)
int[10] ary89 = [8:123, 9:234]; // OK line(8)
}
sary_bug.d(4): Error: mismatched array lengths, 4 and 1
sary_bug.d(6): Error: mismatched array lengths, 10 and 1
sary_bug.d(7): Error: mismatched array lengths, 10 and 2
The difference between (6),(7) of NG and (8) of OK is whether or not their
indexes are ascending from 0.
I suppose this is a regression in recent years.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list