Bug 22101 – Nullable.get(fallback) cannot be used with non-@safe/pure/nothrow types

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-05T07:34:44Z
Last change time
2021-07-05T08:45:19Z
Keywords
pull
Assigned to
No Owner
Creator
Vladimir Panteleev

Comments

Comment #0 by dlang-bugzilla — 2021-07-05T07:34:44Z
////// test.d ////// import std.typecons; struct S { ~this() {} } void main() { Nullable!S s; s.get(S()); } //////////////////// Outputs: .../phobos/std/typecons.d(3091,24): Error: `pure` function `std.typecons.Nullable!(S).Nullable.get!().get` cannot call impure destructor `test.S.~this` .../phobos/std/typecons.d(3091,24): Error: `@safe` function `std.typecons.Nullable!(S).Nullable.get!().get` cannot call `@system` destructor `test.S.~this` test.d(5,2): `test.S.~this` is declared here .../phobos/std/typecons.d(3091,24): Error: destructor `test.S.~this` is not `nothrow` .../phobos/std/typecons.d(3091,24): Error: `nothrow` function `std.typecons.Nullable!(S).Nullable.get!().get` may throw test.d(11,7): Error: template instance `std.typecons.Nullable!(S).Nullable.get!()` error instantiating
Comment #1 by dlang-bot — 2021-07-05T07:36:07Z
@CyberShadow created dlang/phobos pull request #8159 "Fix Issue 22101 - Nullable.get(fallback) cannot be used with non-@saf…" fixing this issue: - Fix Issue 22101 - Nullable.get(fallback) cannot be used with non-@safe/pure/nothrow types https://github.com/dlang/phobos/pull/8159
Comment #2 by dlang-bot — 2021-07-05T08:45:19Z
dlang/phobos pull request #8159 "Fix Issue 22101 - Nullable.get(fallback) cannot be used with non-@saf…" was merged into master: - 7d666a26c052a66fffb7c609c964a91525d3f3c2 by Vladimir Panteleev: Fix Issue 22101 - Nullable.get(fallback) cannot be used with non-@safe/pure/nothrow types https://github.com/dlang/phobos/pull/8159