digitalmars.D.bugs - [Issue 3552] New: Compile time assertion error with associative arrays of class types
- d-bugmail puremagic.com (51/51) Nov 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (8/8) Nov 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (13/13) Nov 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (19/19) Nov 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (10/10) Nov 25 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (35/35) Dec 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (10/10) Jan 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (10/10) Jan 23 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3552
- d-bugmail puremagic.com (11/11) Jan 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3552
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Summary: Compile time assertion error with associative arrays of class types Product: D Version: 2.036 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: justin.greenwood gmail.com 07:35:36 PST --- Created an attachment (id=518) The simple example that shows the error. I have attached two files, both simple code illustrating the error I've run into. In the testAssociativeArrayFails.d file, there is a foreach block that iterates through an associative array. If that foreach block is removed, the file compiles fine. The error is not really meaningful and I imagine the assertion errors in the compiler should not happen. To help show what is causing the bug, I wrote the same sample class without using a Variant internally in my class and everything works fantastically. I put a shitload of time trying to figure out the error in a much more complicated program - this error just started when I upgraded to the newest version of DMD 2.x. I hope you can make use of my example code. When I run the attached files, this is the output: ------------------------------------------------------------------------------- F:\projects\home\home-svn\d\www>c:\d\dmd2\windows\bin\dmd.exe ".\src\testAssocia tiveArrayFails.d" -of.\bin\testAssociativeArrayFails.exe .\src\testAssociativeArrayFails.d(14): Error: template instance AssociativeArray is not a template declaration, it is a overloadset Assertion failure: 'impl' on line 3351 in file 'mtype.c' abnormal program termination F:\projects\home\home-svn\d\www>.\bin\testAssociativeArrayFails.exe '.\bin\testAssociativeArrayFails.exe' is not recognized as an internal or extern al command, operable program or batch file. F:\projects\home\home-svn\d\www>c:\d\dmd2\windows\bin\dmd.exe ".\src\testAssocia tiveArrayWorks.d" -of.\bin\testAssociativeArrayWorks.exe F:\projects\home\home-svn\d\www>.\bin\testAssociativeArrayWorks.exe ** Associative Array using Classes without variants ** true = 12.32 12 = 14 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3552 07:36:28 PST --- Created an attachment (id=519) The simple example that doesn't fail because I removed the use of the variant module. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code CC| |clugdbug yahoo.com.au Summary|Compile time assertion |ICE(mtype.c): associative |error with associative |arrays of class types |arrays of class types | Severity|normal |regression -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|ICE(mtype.c): associative |ICE(mtype.c): declaring a |arrays of class types |variable called | |'AssociativeArray' then | |using an AA. Reduced test case shows it's very silly. Obviously it's a name lookup problem. void main() { int AssociativeArray; int[int] foo; foreach (x; foo) { } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3552 19:24:56 PST --- FYI - For anyone that needs to work around this temporarily, just copy the std.variant module to a different module location. Change the module declaration at the top to match the new location and replace the text "AssociativeArray" with another name (be careful not to replace "isAssociativeArray"). Worked for me - at least until a new build is released. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 25 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch PATCH: Instead of trying to instantiate AssociativeArray, do .AssociativeArray instead. Index: mtype.c =================================================================== --- mtype.c (revision 317) +++ mtype.c (working copy) -3854,13 +3854,14 * But the instantiation can fail if it is a template specialization field * which has Tident's instead of real types. */ - TemplateInstance *ti = new TemplateInstance(loc, Id::AssociativeArray); + Objects *tiargs = new Objects(); tiargs->push(index); tiargs->push(next); - ti->tiargs = tiargs; + DotTemplateInstanceExp *dti = new DotTemplateInstanceExp(loc, new IdentifierExp(loc, Id::empty), Id::AssociativeArray, tiargs); - ti->semantic(sc); + dti->semantic(sc); + TemplateInstance *ti = dti->ti; ti->semantic2(sc); ti->semantic3(sc); impl = ti->toAlias()->isStructDeclaration(); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lmb stackedboxes.org *** Issue 3692 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 02:51:04 PST --- Changeset 352 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 23 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3552 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED 22:45:16 PST --- fixed dmd 2.040 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2010