Add a macro to static cast with dynamic cast checking in debug mode.