November 21, 2021
https://issues.dlang.org/show_bug.cgi?id=22530

          Issue ID: 22530
           Summary: Explicit cast between classes incorrectly goes through
                    'alias this' inside CTFE
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: boris2.9@gmail.com

test:

class D { }

class C
{
    D y = new D();
    alias y this;
}

void main()
{
    static assert(cast(D)(new C) is null); // fails

    assert(cast(D)(new C) is null); // runtime version is OK
}

--