[Issue 14078] Call DTor for stack allocated objects

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 29 13:12:57 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14078

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar at ketmar.no-ip.org

--- Comment #1 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
`emplace` is not a built-in. one can write alot of emplace-like functions that
allocates any memory for the object. even the function named `emplace`, that
will sometimes allocates on stack and sometimes uses `malloc()`.

what you actually asking is compiler that is able to use some AI to see what
programmer *means* by writing the code. this is not possible.

if you want stack-allocated classes with automatic dtors, why don't use
`std.typecons.scoped`?

--


More information about the Digitalmars-d-bugs mailing list