www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19435] New: AssertError when trying to print an array of

https://issues.dlang.org/show_bug.cgi?id=19435

          Issue ID: 19435
           Summary: AssertError when trying to print an array of Nullables
                    containing nullified ones
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: the.mail.of.mi2 gmail.com

Code will be probably sufficient here:

============================================================
import std.stdio;
import std.typecons;

void main()
{
    [Nullable!string.init].writeln;
}
============================================================
core.exception.AssertError /dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(2864):
Called `get' on null Nullable!string.
----------------
??:? _d_assert_msg [0x6fe816de]
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d:2864 inout pure nothrow
ref  property  nogc  safe inout(immutable(char)[])
std.typecons.Nullable!(immutable(char)[]).Nullable.get() [0x6fe701c5]
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d:3425  safe void
std.format.formatElement!(std.stdio.File.LockingTextWriter,
std.typecons.Nullable!(immutable(char)[]).Nullable, char).formatElement(ref
std.stdio.File.LockingTextWriter,
std.typecons.Nullable!(immutable(char)[]).Nullable, ref
const(std.format.FormatSpec!(char).FormatSpec)) [0x6fe7c5b4]
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d:3312  safe void
std.format.formatRange!(std.stdio.File.LockingTextWriter,
std.typecons.Nullable!(immutable(char)[]).Nullable[], char).formatRange(ref
std.stdio.File.LockingTextWriter, ref
std.typecons.Nullable!(immutable(char)[]).Nullable[], ref
const(std.format.FormatSpec!(char).FormatSpec)) [0x6fe7c04b]
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d:3000  safe void
std.format.formatValueImpl!(std.stdio.File.LockingTextWriter,
std.typecons.Nullable!(immutable(char)[]).Nullable[], char).formatValueImpl(ref
std.stdio.File.LockingTextWriter,
std.typecons.Nullable!(immutable(char)[]).Nullable[], ref
const(std.format.FormatSpec!(char).FormatSpec)) [0x6fe7be8c]
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d:1853  safe void
std.format.formatValue!(std.stdio.File.LockingTextWriter,
std.typecons.Nullable!(immutable(char)[]).Nullable[], char).formatValue(ref
std.stdio.File.LockingTextWriter, ref
std.typecons.Nullable!(immutable(char)[]).Nullable[], ref
const(std.format.FormatSpec!(char).FormatSpec)) [0x6fe7be5f]
/dlang/dmd/linux/bin64/../../src/phobos/std/format.d:574  safe uint
std.format.formattedWrite!(std.stdio.File.LockingTextWriter, char,
std.typecons.Nullable!(immutable(char)[]).Nullable[]).formattedWrite(ref
std.stdio.File.LockingTextWriter, const(char[]),
std.typecons.Nullable!(immutable(char)[]).Nullable[]) [0x6fe7b2b9]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:1505  safe void
std.stdio.File.write!(std.typecons.Nullable!(immutable(char)[]).Nullable[],
char).write(std.typecons.Nullable!(immutable(char)[]).Nullable[], char)
[0x6fe7af0e]
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:3811  safe void
std.stdio.writeln!(std.typecons.Nullable!(immutable(char)[]).Nullable[]).writeln(std.typecons.Nullable!(immutable(char)[]).Nullable[])
[0x6fe7ae73]
onlineapp.d:6 _Dmain [0x6fe700a9]

--
Nov 26 2018