digitalmars.D.bugs - [Issue 5678] New: new enum struct re-allocated at compile time
- d-bugmail puremagic.com (68/68) Mar 01 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5678
- d-bugmail puremagic.com (13/13) Apr 15 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5678
- d-bugmail puremagic.com (6/6) Apr 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5678
- d-bugmail puremagic.com (9/10) Apr 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5678
http://d.puremagic.com/issues/show_bug.cgi?id=5678
Summary: new enum struct re-allocated at compile time
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
DMD 2.052, this gives an Assertion failure:
struct Foo {
this(int) {}
}
enum Foo* f = new Foo(0);
void main() {
assert(f == f); // Assertion failure
}
In my opinion this needs to become a compile-time error, or the assert needs to
pass.
Enum associative arrays have a similar problem.
------------------
The asm:
_D4test3Foo6__ctorMFNciZS4test3Foo comdat
enter 4,0
leave
ret 4
__Dmain comdat
L0: push 1
mov EAX,offset FLAT:_D20TypeInfo_PS4test3Foo6__initZ
push EAX
call near ptr __d_newarrayT
add ESP,8
push 0
mov EAX,EDX
call near ptr _D4test3Foo6__ctorMFNciZS4test3Foo
push EAX
push 1
mov ECX,offset FLAT:_D20TypeInfo_PS4test3Foo6__initZ
push ECX
call near ptr __d_newarrayT
add ESP,8
push 0
mov EAX,EDX
call near ptr _D4test3Foo6__ctorMFNciZS4test3Foo
mov EDX,EAX
pop EAX
cmp EAX,EDX
je L44
mov EAX,6
call near ptr _D4test8__assertFiZv
L44: xor EAX,EAX
ret
_D4test8__assertFiZv comdat
L0: enter 4,0
push EAX
mov ECX,offset FLAT:_D4test12__ModuleInfoZ
push ECX
call near ptr __d_assertm
leave
ret
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 01 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5678
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |clugdbug yahoo.com.au
Resolution| |FIXED
Fixed
https://github.com/D-Programming-Language/dmd/commit/47d46bf1364c63df5bb01406db4098c771d701dd
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 15 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5678 Is the same problem with associative arrays in another bug report? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5678Is the same problem with associative arrays in another bug report?The general bug, which includes AAs, was fixed with this commit: https://github.com/donc/dmd/commit/fc67046cf1e66182d959309fb15ef9e2d4c266b9 The only thing which was unique to this one is the use of 'new'. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 16 2011









d-bugmail puremagic.com 