[Issue 22101] New: Nullable.get(fallback) cannot be used with non- at safe/pure/nothrow types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 5 07:34:44 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22101
Issue ID: 22101
Summary: Nullable.get(fallback) cannot be used with
non- at safe/pure/nothrow types
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P3
Component: phobos
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
////// 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
--
More information about the Digitalmars-d-bugs
mailing list