February 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23749

          Issue ID: 23749
           Summary: Can't writeln a static array of strings with
                    -preview=dip1000
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: snarwin+bugzilla@gmail.com

As of DMD 2.102.1, the following program fails to compile when using -preview=dip1000:

---
import std.stdio;

void main() @safe
{
        string[1] a = ["hello"];
        writeln(a);
}
---

The error message is:

---
bug.d(6): Error: `@safe` function `D main` cannot call `@system` function
`std.stdio.writeln!(string[1]).writeln`
/usr/include/dmd/phobos/std/stdio.d(1708):        which calls
`std.stdio.File.write!(string[1], char).write`
/usr/include/dmd/phobos/std/format/write.d(527):        which calls
`std.format.write.formattedWrite!(LockingTextWriter, char,
string[1]).formattedWrite`
/usr/include/dmd/phobos/std/format/write.d(1231):        which calls
`std.format.write.formatValue!(LockingTextWriter, string[1], char).formatValue`
/usr/include/dmd/phobos/std/format/internal/write.d(1340):        which calls
`std.format.internal.write.formatValueImpl!(LockingTextWriter, string[1],
char).formatValueImpl`
/usr/include/dmd/phobos/std/format/internal/write.d(1344):        which was
inferred `@system` because of:
/usr/include/dmd/phobos/std/format/internal/write.d(1344):        reference to
local variable `obj` assigned to non-scope parameter `obj` calling
`formatValueImpl`
/usr/include/dmd/phobos/std/stdio.d(4209):
`std.stdio.writeln!(string[1]).writeln` is declared here
---

--