Compiler: DMD 2.097.1 Error: ``` ../../src/druntime/import/core/internal/hash.d(612,33): Error: expected 2 arguments for `getMember` but had 1 source/app.d(30,26): Error: template instance `core.internal.hash.hashOf!(Bug!string)` error instantiating ``` Test Code: ``` import std.range; interface IObject { size_t toHash() @trusted nothrow; } interface Bug(E) : InputRange!E, IObject { } interface OK(E) : IObject, InputRange!E { } void main() { { Bug!string s; size_t t = hashOf(s); } { OK!string s; size_t t = hashOf(s); } } ```
Seems to be a regression. Works fine on dmd 2.097.0 (https://run.dlang.io/gist/cb1ed3bd5db4cf5b99e26454116b969a?args=-h) Works fine on ldc2 1.25.0 (based on 2.095.1)
I did some digging on this, and the bug actually stems from the following issue ``` interface IObject { size_t toHash() @trusted nothrow; } interface Dummy {} interface Bug(E) : Dummy, IObject {} interface OK(E) : IObject, Dummy {} static assert(is(immutable OK!string* : immutable IObject*))); // OK static assert(is(immutable Bug!string* : immutable IObject*))); // fails ``` It appears that the order affects the is expression and the `is(immutable T* : immutable U*)` check is done inside the `hashOf` function. I'm currently investigating this in dmd.
@edi33416 created dlang/dmd pull request #13404 "Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of d…" fixing this issue: - Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of different inheritance order https://github.com/dlang/dmd/pull/13404
dlang/dmd pull request #13404 "Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of d…" was merged into stable: - 289394fab4695d3f601767ea004f9c1737880395 by Eduard Staniloiu: Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of different inheritance order https://github.com/dlang/dmd/pull/13404
dlang/dmd pull request #13745 "Revert "Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of d…"" was merged into stable: - 646fe4e97e1dae3e083ae461931f123f036bd4cf by Nathan Sashihara: Revert "Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of different inheritance order (#13404)" This reverts commit 646ec178ffa13cf596026dae4217fdad27ad777c. https://github.com/dlang/dmd/pull/13745
dlang/dmd pull request #13785 "merge stable" was merged into master: - da491b8ada5f557a222c369f7f1bb481ca10880e by Nathan Sashihara: Revert "Fix Issue 22136 - [REG 2.097.1] hashOf failed to compile because of different inheritance order (#13404)" (#13745) This reverts commit 646ec178ffa13cf596026dae4217fdad27ad777c. https://github.com/dlang/dmd/pull/13785