[Issue 23245] New: [REG 2.099] std.format ignores non-const toString method of static array element
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 13 18:17:24 UTC 2022
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: nobody at puremagic.com
Reporter: snarwin+bugzilla at 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;
S[1] s;
assert(format("%s", s[0]) == "S"); // ok
assert(format("%s", s) == "[S]"); // fails
}
---
The error is
---
core.exception.AssertError at onlineapp.d(12): "[const(S)()]" != "[S]"
---
As of DMD 2.098.1, the above program compiled and ran to completion without any
errors.
--
More information about the Digitalmars-d-bugs
mailing list