digitalmars.D.bugs - [Issue 23246] New: [REG 2.099] std.format ignores non-const toString
- d-bugmail puremagic.com (35/35) Jul 13 2022 https://issues.dlang.org/show_bug.cgi?id=23246
https://issues.dlang.org/show_bug.cgi?id=23246 Issue ID: 23246 Summary: [REG 2.099] std.format ignores non-const toString method of associative array value Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: snarwin+bugzilla gmail.com 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, std.stdio; S[int] s = [0: S()]; assert(format("%s", s[0]) == "S"); // ok assert(format("%s", s) == "[0:S]"); // fails } --- The error message is --- core.exception.AssertError onlineapp.d(12): "[0:const(S)()]" != "[0:S]" --- As of DMD 2.098.1, the above program compiled and ran to completion without any errors. --
Jul 13 2022