[Issue 5667] [GSoC] "clear" does not call destructors on structs embedded in structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 7 04:40:52 PDT 2011


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



--- Comment #4 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-07-07 04:35:29 PDT ---
The code for TypeInfo_Struct.destroy is in object_.d:

https://github.com/D-Programming-Language/druntime/blob/master/src/object_.d#L986

It appears that it's using quite a different method to destroy the type
(somewhat necessary since TypeInfo is runtime information).  I'm curious why
calling __dtor isn't the same...

That probably should be the focus of this bug instead of working around the
issue.

(In reply to comment #3)

> This fixes it for me. You need to modifiy import/object.di as well, because
> object_.d doesn't get header'd into object.di, for some reason I don't know.

object.di is hand-maintained to remove some private things that are not
necessary to import.  The less things defined in the .di, the less internal
implementation is exposed, and the less chance someone can exploit
implementation details that shouldn't be relied upon.  I believe it is the only
hand-maintained interface file in druntime.

For templates, however, there is no possibility of implementation hiding -- the
entire source must be available.  I wonder if the templates of object_.d could
be separated into another module so we don't have to modify two files...

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