Loss functions in restricted parameter spaces and their Bayesian applications