[Issue 5685] New: Static Arrays as AA indices
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 2 15:58:45 PST 2011
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 at puremagic.com
ReportedBy: dsimcha at yahoo.com
--- Comment #0 from David Simcha <dsimcha at 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: -------
More information about the Digitalmars-d-bugs
mailing list