digitalmars.D.bugs - [Issue 22184] New: std.sumtype.SumType with mutual recursion causes
- d-bugmail puremagic.com (66/66) Aug 06 2021 https://issues.dlang.org/show_bug.cgi?id=22184
https://issues.dlang.org/show_bug.cgi?id=22184 Issue ID: 22184 Summary: std.sumtype.SumType with mutual recursion causes a forward reference of variable `isHashable` Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: regression Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: ttanjo gmail.com The following code works with dmd 2.096.1 (uses sumtype via dub) but does not work since dmd 2.097.0 (uses sumtype or std.sumtype). I'm not sure it is a regression of std.sumtype or dmd. I tentatively set the `Component` field to `phobos`. run.dang.io - (sumtype): https://run.dlang.io/is/IiGESU - (std.sumtype): https://run.dlang.io/is/j8rqve ```dlang import std.sumtype; class A { SumType!B type; } class B { SumType!C fields; } class C { SumType!(B, int) type; } ``` Error message: ```console /dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/traits.d(191): Error: forward reference of variable `isHashable` /dlang/dmd/linux/bin64/../../src/phobos/std/meta.d(842): Error: template instance `core.internal.traits.allSat!(isHashable, const(B), const(int))` error instantiating /dlang/dmd/linux/bin64/../../src/phobos/std/sumtype.d(771): instantiated from here: `allSatisfy!(isHashable, const(B), const(int))` onlineapp.d(15): instantiated from here: `SumType!(B, int)` /dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/traits.d(191): Error: template instance `std.sumtype.pred!(const(C))` error instantiating /dlang/dmd/linux/bin64/../../src/phobos/std/meta.d(842): instantiated from here: `allSat!(isHashable, const(C))` /dlang/dmd/linux/bin64/../../src/phobos/std/sumtype.d(771): instantiated from here: `allSatisfy!(isHashable, const(C))` onlineapp.d(10): instantiated from here: `SumType!(C)` /dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/traits.d(191): Error: template instance `std.sumtype.pred!(const(B))` error instantiating /dlang/dmd/linux/bin64/../../src/phobos/std/meta.d(842): instantiated from here: `allSat!(isHashable, const(B))` /dlang/dmd/linux/bin64/../../src/phobos/std/sumtype.d(771): instantiated from here: `allSatisfy!(isHashable, const(B))` onlineapp.d(5): instantiated from here: `SumType!(B)` ``` Notes: - It works if `A` is not available - It works if `C` has a field whose type is `SumType!B` rather than `SumType!(B, int)` --
Aug 06 2021