[Issue 10789] Struct destructor erroneously called

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 29 08:36:05 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10789



--- Comment #8 from Kenji Hara <k.hara.pg at gmail.com> 2013-09-29 08:36:03 PDT ---
(In reply to comment #7)
> The original test case still fails on DMD HEAD:
> 
> ---
> 0018FD74 this() 0
> 0018FD75 this(this) 1
> 0018FD74 ~this() 2
> 0018FD9C ~this() 1
> core.exception.AssertError at app(47): Assertion failure
> ---
> 
> This is due to the last destructor running on an uninitialized instance
> (initialized == false).

To me it looks like that the original test case contains a bug.

In S.this(this), `initialized` field is incorrectly set to false. It will stop
to decrement S.count at the destruction of the copied objects. Therefore the
last assertion in main fails because S.count == 1.

-- 
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