Bug 9150 – Mismatching static array length should be detected in foreach

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-13T07:21:00Z
Last change time
2012-12-13T08:48:00Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2012-12-13T07:21:19Z
From the forum discussion: http://forum.dlang.org/thread/[email protected]?page=2#post-gdzjavizncygkbtftpnh:40forum.dlang.org import std.stdio; void main() { int[3][2] matrix = [ [1,11,111], [2,22,222] ]; foreach (int[5] row; matrix) //if int[3], there is no error. { foreach (x; row) write(x, " "); writeln(); } }
Comment #1 by k.hara.pg — 2012-12-13T08:07:14Z
Comment #2 by github-bugzilla — 2012-12-13T08:43:30Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/3f5912d00ab1a81c5c47140026a5dd483840f825 fix Issue 9150 - Mismatching static array length should be detected in foreach https://github.com/D-Programming-Language/dmd/commit/71460c1b20c41c1fc7282fb8832acf43d5a2976c Merge pull request #1373 from 9rnsr/fix9150 Issue 9150 - Mismatching static array length should be detected in foreach