[Issue 20443] Case where code compiles depending on order of declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 23 09:53:37 UTC 2022


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

Tomoya Tanjo <ttanjo at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ttanjo at gmail.com

--- Comment #6 from Tomoya Tanjo <ttanjo at gmail.com> ---
I have a similar issue as reported in the issue 22184.

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(){}
```

I confirmed it does not work with dmd 2.100.2.
It works when the order of declaration is `C`, `A`, and `B`.

--


More information about the Digitalmars-d-bugs mailing list