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

          Issue ID: 23245
           Summary: [REG 2.099] std.format ignores non-const toString
                    method of static array element
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: [email protected]
          Reporter: [email protected]

As of DMD 2.099.1, the following program fails with an AssertError at runtime:

---
struct S
{
    string toString() { return "S"; }
}

void main()
{
    import std.format;

    S[1] s;
    assert(format("%s", s[0]) == "S"); // ok
    assert(format("%s", s) == "[S]"); // fails
}
---

The error is

---
[email protected](12): "[const(S)()]" != "[S]"
---

As of DMD 2.098.1, the above program compiled and ran to completion without any
errors.

--

Reply via email to