digitalmars.D.bugs - [Issue 13653] New: Better error messages for mismatched array literals
- via Digitalmars-d-bugs (28/28) Oct 25 2014 https://issues.dlang.org/show_bug.cgi?id=13653
https://issues.dlang.org/show_bug.cgi?id=13653 Issue ID: 13653 Summary: Better error messages for mismatched array literals Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.cc void main() { uint[1][2] arr1 = [[0, 0]]; int[2] arr2 = [1.5, 2.5]; } DMD 2.067alpha gives a strange error messages: test.d(2,23): Error: cannot implicitly convert expression ([[0, 0]]) of type int[][] to uint[] test.d(3,19): Error: cannot implicitly convert expression ([1.5, 2.5]) of type double[] to int[] But I suggest to give more clear error message, something like: test.d(2,23): Error: array sizes mismatch, cannot implicitly convert array literal of shape (2, 1) to shape (1, 2) test.d(3,19): Error: cannot implicitly convert expression ([1.5, 2.5]) of type double[] to int[2] --
Oct 25 2014