[Issue 22136] [REG 2.097.1] hashOf failed to compile because of different inheritance order

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 8 18:07:08 UTC 2021


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

--- Comment #2 from Eduard Staniloiu <edi33416 at gmail.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list