Regression was introduced in 1c79f85d00.
Invalid casts lead to crashes in macOS notifications handling.
Casts were T* -> has_weak_ptr* -> void* -> T* which was not working
in case T had has_weak_ptr as not first base class.
Now it uses just T* -> has_weak_ptr* -> T* casts.