Thread overview
[Issue 8304] writeln of empty Nullables too
Jul 13, 2019
Tobias Pankrath
October 08, 2014
https://issues.dlang.org/show_bug.cgi?id=8304

monkeyworks12@hotmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monkeyworks12@hotmail.com

--- Comment #4 from monkeyworks12@hotmail.com ---
*** Issue 10915 has been marked as a duplicate of this issue. ***

--
October 31, 2014
https://issues.dlang.org/show_bug.cgi?id=8304

--- Comment #5 from bearophile_hugs@eml.cc ---
This has improved the situation: https://github.com/D-Programming-Language/phobos/pull/2587


But the example in comment #1 still fails:


void main() {
    import std.stdio: writeln;
    import std.typecons: Nullable;
    const(Nullable!int) c;
    writeln(c);
}


core.exception.AssertError@C:\dmd2\src\phobos\std\typecons.d(1529): Called `get' on null Nullable!int.

--
October 31, 2014
https://issues.dlang.org/show_bug.cgi?id=8304

--- Comment #6 from bearophile_hugs@eml.cc ---
*** Issue 10915 has been marked as a duplicate of this issue. ***

--
October 15, 2016
https://issues.dlang.org/show_bug.cgi?id=8304

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |andrei@erdani.com

--
July 13, 2019
https://issues.dlang.org/show_bug.cgi?id=8304

Tobias Pankrath <tobias@pankrath.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tobias@pankrath.net
         Resolution|---                         |FIXED

--- Comment #7 from Tobias Pankrath <tobias@pankrath.net> ---
import std.stdio;
import std.typecons;

void main() {
        Nullable!string s;
        writeln(s);
}

now prints "Nullable.null".

--