www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22101] New: Nullable.get(fallback) cannot be used with


          Issue ID: 22101
           Summary: Nullable.get(fallback) cannot be used with
                    non- safe/pure/nothrow types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

////// test.d //////
import std.typecons;

struct S
    ~this() {}

void main()
    Nullable!S s;


.../phobos/std/typecons.d(3091,24): Error: `pure` function
`std.typecons.Nullable!(S).Nullable.get!().get` cannot call impure destructor
.../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
.../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

Jul 05 2021