digitalmars.D.bugs - [Issue 11181] New: Missing compile-time error for wrong array literal
- d-bugmail puremagic.com (30/30) Oct 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11181
http://d.puremagic.com/issues/show_bug.cgi?id=11181 Summary: Missing compile-time error for wrong array literal Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc void main() { const string[][] a = [["a", "b"], "x"]; } DMD 2.064 alpha gives the right error: test.d(2): Error: incompatible types for ((["a", "b"]) : ("x")): 'string[]' and 'string' But: void main() { auto a = ["a", "b"]; const string[][] b = [a[0 .. $], "x"]; } Gives no compile-time errors, and gives at run-time: object.Error: array cast misalignment -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2013