Fix ICE when calling static and static mut function pointers

Fixes #8588