[Issue 22184] std.sumtype.SumType with mutual recursion causes a forward reference of variable `isHashable`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 11 14:29:08 UTC 2021


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

--- Comment #2 from Tomoya Tanjo <ttanjo at gmail.com> ---
I reduced the above code as follows:

run.dlang.io: https://run.dlang.io/is/VZtiPO


```dlang
class A
{
    static if (isHashable!B) {}
}

class B
{
    static if (isHashable!C) {}
}

class C
{
    static if (isHashable!B && isHashable!int) {}
}

enum isHashable(T) = __traits(compiles,
    () { T.init; }
);

void main(){}
```

- It compiles successfully if `isHashable` checks `T t;` rather than `T.init;`

--


More information about the Digitalmars-d-bugs mailing list