digitalmars.D.bugs - [Issue 2333] New: Hash initializer does not work
- d-bugmail puremagic.com (20/20) Sep 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (18/18) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (12/12) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (5/24) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (5/11) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (21/21) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (8/14) Sep 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (9/9) Oct 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
- d-bugmail puremagic.com (8/8) Nov 18 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2333
http://d.puremagic.com/issues/show_bug.cgi?id=2333 Summary: Hash initializer does not work Product: D Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: andrei metalanguage.com The assertion in this program fails: void main() { int[string] stopWords = [ "abc"[]:1 ]; assert("abc" in stopWords); } This is so bad I must in fact be doing something wrong... --
Sep 02 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333 Even more: this program: import std.stdio; void main() { int[string] foo = ["aaa":1, "bbb":2]; foo["ccc"] = 3; writeln(foo); writeln("aaa" in foo); writeln("ccc" in foo); } prints this: [aaa:1,bbb:2,ccc:3] 0 8F4FB4 when compiled using Windows DMD 2.018. --
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333 gide nwawudu.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid The docs says 'An AssocArrayLiteral cannot be used to statically initialize anything', so the code should be rejected by the compiler. Changed keyword to acepts-invalid. http://www.digitalmars.com/d/2.0/expression.html#AssocArrayLiteral BTW I've made the same mistake, see BUG 1727. --
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333Even more: this program: import std.stdio; void main() { int[string] foo = ["aaa":1, "bbb":2]; foo["ccc"] = 3; writeln(foo); writeln("aaa" in foo); writeln("ccc" in foo); } prints this: [aaa:1,bbb:2,ccc:3] 0 8F4FB4 when compiled using Windows DMD 2.018.The last line is fine. "in" returns a pointer. --
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333The docs says 'An AssocArrayLiteral cannot be used to statically initialize anything', so the code should be rejected by the compiler. Changed keyword to acepts-invalid. http://www.digitalmars.com/d/2.0/expression.html#AssocArrayLiteral BTW I've made the same mistake, see BUG 1727.Notice that I'm using straight initialization, not static initialization. --
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333 gide nwawudu.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|accepts-invalid |wrong-code In that case my comment on bug 1727 was valid, I'll repeat it here. The following code compiles on both GDC and DMD, but DMD compiled code throws an array bounds exception when executed. test.d ------ import std.stdio; void main() { int[char[]] aa = ["aa":1, "bb":2, "cc":3]; // Fails later //int[char[]] aa; aa = ["aa":1, "bb":2, "cc":3]; // Fails later //int[char[]] aa; aa["aa"] = 1; aa["bb"] = 2; aa["cc"] = 3; // OK assert(aa.length == 3); assert(aa["aa"]==1); // DMD fails here. Error: ArrayBoundsError test(9) writefln(aa["aa"],aa["bb"],aa["cc"]); // On GDC output -> 123 } --
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333I know. I posted this to maybe help to narrow down the issue. The printed array contents are correct. The explicitly added key ("ccc") is found correctly. But, at the same time, the key "aaa" is not found even though it seems to be present in the AA. --[aaa:1,bbb:2,ccc:3] 0 8F4FB4The last line is fine. "in" returns a pointer.
Sep 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 2.020 --
Oct 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2333 gide nwawudu.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lutger.blijdestijn gmail.com *** Bug 2265 has been marked as a duplicate of this bug. *** --
Nov 18 2008