]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gdc.test/fail_compilation/test9150.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test9150.d
CommitLineData
5fee5ec3
IB
1// https://issues.dlang.org/show_bug.cgi?id=9150
2// Mismatching static array length should be detected in foreach
b4c522fa
IB
3/*
4TEST_OUTPUT:
5---
6fail_compilation/test9150.d(14): Error: mismatched array lengths, 5 and 3
7---
8*/
9
10void main()
11{
12 int[3][2] matrix = [ [1,11,111], [2,22,222] ];
13
14 foreach (int[5] row; matrix) //if int[3], there is no error.
15 {
16 foreach (x; row)
17 {}//write(x, " ");
18
19 //writeln();
20 }
21}