Bug 24403 – Nullable doesn't work with non-mutable types with a destructor

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-02-21T05:01:59Z
Last change time
2024-02-21T11:06:35Z
Keywords
pull
Assigned to
No Owner
Creator
Jonathan M Davis

Comments

Comment #0 by issues.dlang — 2024-02-21T05:01:59Z
This code does not compile but should: --- void main() { import std.typecons : Nullable; static struct S { ~this() { } } Nullable!(const S) s; } --- Nullable's destructor is able to handle mutable types but not const or immutable types.
Comment #1 by dlang-bot — 2024-02-21T06:03:19Z
@jmdavis created dlang/phobos pull request #8917 "fix Bugzilla Issue 24403 - Nullable doesn't work with non-mutable types with a destructor" fixing this issue: - fix Bugzilla Issue 24403 - Nullable doesn't work with non-mutable types with a destructor This should make it so that a variable of type Nullable!T has the same behavior with regards to destruction as a variable of type T even when it's const, immutable, or shared. https://github.com/dlang/phobos/pull/8917
Comment #2 by dlang-bot — 2024-02-21T11:06:35Z
dlang/phobos pull request #8917 "fix Bugzilla Issue 24403 - Nullable doesn't work with non-mutable types with a destructor" was merged into master: - 4d9ca315b7cb1925ebf620a8f30f8bf7b47390c4 by Jonathan M Davis: fix Bugzilla Issue 24403 - Nullable doesn't work with non-mutable types with a destructor This should make it so that a variable of type Nullable!T has the same behavior with regards to destruction as a variable of type T even when it's const, immutable, or shared. https://github.com/dlang/phobos/pull/8917