Remove unused function castp in the Foreign_basis module