Bug 15829 – hasElaborateDestructor doesn't work for classes

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-24T20:07:20Z
Last change time
2020-03-21T03:56:40Z
Keywords
pull
Assigned to
No Owner
Creator
ZombineDev

Comments

Comment #0 by petar.p.kirov — 2016-03-24T20:07:20Z
class C2 { ~this() {} } static assert (hasElaborateDestructor!C1); // fails
Comment #1 by petar.p.kirov — 2016-03-25T11:05:32Z
Comment #2 by nick — 2016-04-05T11:39:14Z
Just for the record, this is by design according to the docs. It would be nice if hasElaborateDestructor didn't compile for reference types. I don't know if the breakage is acceptable, but at least it would enforce correct usage.
Comment #3 by petar.p.kirov — 2016-04-05T12:04:06Z
But what about generic code that already (wrongly) relies on hasElaborateDestructor (such as std.experimental.allocator)? Should we add hasElaborateDestructor2 that handles both classes and structs and errors on unions?
Comment #4 by b2.temp — 2017-09-18T00:19:56Z