https://issues.dlang.org/show_bug.cgi?id=17269
Thibaut CHARLES <cro...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cro...@gmail.com --- Comment #5 from Thibaut CHARLES <cro...@gmail.com> --- struct TestInt { Nullable!int value; } writeln(TestInt());//Print: Nullable.null struct TestString { Nullable!string value; } writeln(TestString());//Raise exception Nullable!string is implicitly convertible to a string, thus calling the following std.format.formatElement overloading: ``` void formatElement(Writer, T, Char)(auto ref Writer w, T val, const ref FormatSpec!Char f) if (is(StringTypeOf!T) && !is(T == enum)) ``` that generates the exception when trying to store the string value in a variable here: https://github.com/dlang/phobos/blob/05e65e6086d8d5ebdd1b95350cb6a79a1198e7d0/std/format.d#L3072 The correct called overloading should be: ``` void formatElement(Writer, T, Char)(auto ref Writer w, auto ref T val, const ref FormatSpec!Char f) if (!is(StringTypeOf!T) && !is(CharTypeOf!T) || is(T == enum)) ``` that forwards to a formatValue call. I am currently working on a pull request --