digitalmars.D.bugs - [Issue 4939] New: Some compile-time length tests of array concats
- d-bugmail puremagic.com (47/47) Sep 25 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4939
http://d.puremagic.com/issues/show_bug.cgi?id=4939 Summary: Some compile-time length tests of array concats Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid, diagnostic Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is a wrong D2 program, because the lengths of the arrays don't match: void main() { int[2] a1; int[3] a2; int[6] result; result[] = a1 ~ a2; } It compiles with no errors, because a1~a2 produces a dynamic array, despite its length is determined at compile-time. I'd like the compile to catch this bug at compile-time. implementation of the same kind of tests may catch at compile-time more common cases, like: void main() { int[] a1 = new int[2]; int[] a2 = new int[3]; int[6] result; result[] = a1 ~ a2; // Error a1 ~= 0; result[] = a1 ~ a2; } void main() { int[] a1 = new int[2]; int[] a2 = new int[3]; int[] result = new int[6]; result[] = a1 ~ a2; // Error } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2010