Class C defines a function f. Class D overrides it, but has a different generic constraint. Calling f from an instance of C using type(of:) type-checks as though C.f will be called, but at runtime D.f is called.
Because D.f tries to access a member of E, the program reads random memory, leading to undefined behavior.
As an aside, the ability to tighten type constraints on overrides is actually very useful in the context of the code I was working on when I discovered this. I'd like to be able to write things like var functionToRunWhenSomethingChanges: (Self, Context) -> (), which creates similar issues to this when used in the context of classes. So my solution was to make var functionToRunWhenSomethingChanges: (Any, Context) -> (), and have a setFunctionToRunWhenSomethingChanges<T>(on subject: T, _ function: (T, Context) -> ()), which ensures that things are still type safe. So It's useful to be able to add generic constraints that require that a particular class func only works for subclasses of the type that it's implemented for. Hopefully when/if this is fixed it's still possible to do that.