March 02, 2011 [Issue 5685] New: Static Arrays as AA indices | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5685 Summary: Static Arrays as AA indices Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: accepts-invalid, wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: dsimcha@yahoo.com --- Comment #0 from David Simcha <dsimcha@yahoo.com> 2011-03-02 15:55:52 PST --- The following (arguably valid, arguably invalid) code compiles successfully but produces wrong results at runtime: void main() { int[2] foo = [1, 2]; string[int[2]] aa; aa[foo] = ""; assert([1, 2] in aa); // FAILS } It should either be a compiler error (if the literal [1, 2] is treated as a dynamic array and polymorphism between dynamic and static arrays is disallowed) or it should work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation