Handle static functions being redeclared in function scope.

Fixes pr14861.