[Issue 11181] New: Missing compile-time error for wrong array literal
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 6 02:58:34 PDT 2013
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 at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-10-06 02:58:30 PDT ---
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: -------
More information about the Digitalmars-d-bugs
mailing list