Merge pull request #2423 from hzeller/feature-20250531-limit-down-cast

Don't use down_cast<> with the assumption that type-mismatch returns …