Stop ICE when using foreign statics in statics

Only change is to stop an ICE when a foreign static are referenced in
consts and statics.

See: #16538, #16479, #14227, #13325