Fix compile error when assigning weak pointers.