Testcase: ``` enum State: ubyte { INACTIVE, } static struct S { State state = State.INACTIVE; int generation = 1; alias state this; // DMDBUG: https://issues.dlang.org/show_bug.cgi?id=16657 auto opEquals(S other) const { return state == other.state && generation == other.generation; } auto opEquals(State other) const { return state == other; } } void main() { S a; import std.format; auto str = format("%s", a); } ``` Since 2.097, compilation errors with: ``` std/format/internal/write.d(248): Error: none of the overloads of `opEquals` are callable using argument types `(int)`, candidates are: <source>(9): `example.S.opEquals(S other)` <source>(10): `example.S.opEquals(State other)` std/format/internal/write.d(253): Error: none of the overloads of `opEquals` are callable using argument types `(int)`, candidates are: <source>(9): `example.S.opEquals(S other)` <source>(10): `example.S.opEquals(State other)` std/format/write.d(1239): Error: template instance `std.format.internal.write.formatValueImpl!(Appender!string, S, char)` error instantiating std/format/write.d(632): instantiated from here: `formatValue!(Appender!string, S, char)` std/format/package.d(779): instantiated from here: `formattedWrite!(Appender!string, char, S)` <source>(17): instantiated from here: `format!(char, S)` ASM generation compiler returned: 1 std/format/internal/write.d(248): Error: none of the overloads of `opEquals` are callable using argument types `(int)`, candidates are: <source>(9): `example.S.opEquals(S other)` <source>(10): `example.S.opEquals(State other)` std/format/internal/write.d(253): Error: none of the overloads of `opEquals` are callable using argument types `(int)`, candidates are: <source>(9): `example.S.opEquals(S other)` <source>(10): `example.S.opEquals(State other)` std/format/write.d(1239): Error: template instance `std.format.internal.write.formatValueImpl!(Appender!string, S, char)` error instantiating /opt/compiler-explorer/ldc1.27.1/ldc2-1.27.1-linux-x86_64/bin/../import/std/format/write.d(632): instantiated from here: `formatValue!(Appender!string, S, char)` /opt/compiler-explorer/ldc1.27.1/ldc2-1.27.1-linux-x86_64/bin/../import/std/format/package.d(779): instantiated from here: `formattedWrite!(Appender!string, char, S)` <source>(17): instantiated from here: `format!(char, S)` ``` This appears to be fixed by https://github.com/dlang/phobos/pull/8278, which replaces the `obj != 0` comparison with a zero comparison after casting to `ulong` first.
@nordlow created dlang/phobos pull request #8339 "Add unittest for issue 22609" mentioning this issue: - Add unittest for issue 22609 https://github.com/dlang/phobos/pull/8339
dlang/phobos pull request #8339 "Add unittest for issue 22609" was merged into master: - fa882c0e039eb3972aef46e19cbde8cb5fc7a702 by Per Nordlöw: Add unittest for issue 22609 https://github.com/dlang/phobos/pull/8339
Confirmed to work on latest master. @RazvanN credit for fixing this goes to Per Norlöw. If the scores for the first round of the bugfix campaing are still around somewhere, Per should receive +100 posthumously.