Add a testcase where we replace a destructor with an alias.

This is a reduced testcase from a cast to Function failing during bootstrap.