[Issue 22136] New: hashOf failed to compile because of different inheritance order in DMD 2.097.1

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 22 09:54:59 UTC 2021


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

          Issue ID: 22136
           Summary: hashOf failed to compile because of different
                    inheritance order in DMD 2.097.1
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: bitworld at qq.com

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);
    }    
}
```

--


More information about the Digitalmars-d-bugs mailing list