Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 25, 2009 [Issue 3552] New: Compile time assertion error with associative arrays of class types | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Justin Greenwood <justin.greenwood@gmail.com> 2009-11-25 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: ------- |
November 25, 2009 [Issue 3552] Compile time assertion error with associative arrays of class types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | http://d.puremagic.com/issues/show_bug.cgi?id=3552 --- Comment #1 from Justin Greenwood <justin.greenwood@gmail.com> 2009-11-25 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: ------- |
November 25, 2009 [Issue 3552] ICE(mtype.c): associative arrays of class types | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | 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: ------- |
November 25, 2009 [Issue 3552] ICE(mtype.c): declaring a variable called 'AssociativeArray' then using an AA. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | 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. --- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-11-25 08:08:50 PST --- 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: ------- |
November 26, 2009 [Issue 3552] ICE(mtype.c): declaring a variable called 'AssociativeArray' then using an AA. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | http://d.puremagic.com/issues/show_bug.cgi?id=3552 --- Comment #3 from Justin Greenwood <justin.greenwood@gmail.com> 2009-11-25 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: ------- |
December 29, 2009 [Issue 3552] ICE(mtype.c): declaring a variable called 'AssociativeArray' then using an AA. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | http://d.puremagic.com/issues/show_bug.cgi?id=3552 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #4 from Don <clugdbug@yahoo.com.au> 2009-12-29 00:58:15 PST --- 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: ------- |
January 09, 2010 [Issue 3552] ICE(mtype.c): declaring a variable called 'AssociativeArray' then using an AA. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | http://d.puremagic.com/issues/show_bug.cgi?id=3552 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lmb@stackedboxes.org --- Comment #5 from Don <clugdbug@yahoo.com.au> 2010-01-08 22:01:29 PST --- *** 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: ------- |
January 23, 2010 [Issue 3552] ICE(mtype.c): declaring a variable called 'AssociativeArray' then using an AA. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | http://d.puremagic.com/issues/show_bug.cgi?id=3552 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2010-01-23 02:51:04 PST --- Changeset 352 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 31, 2010 [Issue 3552] ICE(mtype.c): declaring a variable called 'AssociativeArray' then using an AA. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Justin Greenwood | http://d.puremagic.com/issues/show_bug.cgi?id=3552 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #7 from Walter Bright <bugzilla@digitalmars.com> 2010-01-30 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: ------- |
Copyright © 1999-2021 by the D Language Foundation