When do dress codes get discriminatory?

Jean-Marie_Céline
When do dress codes get discriminatory?
Special thanks to @Still-alive and his question If a woman dresses "inappropriately" at the work place what would YOU do about it? that inspired me to ask this one.
Personally I think it gets discriminatory when it forces people to wear clothing they hate, feel too uncomfortable in or humiliate them. Personally I give a lot of leeway to my entourage for the office work and field trips, however they are sensible enough to understand when an occasion is formal enough to warrant wearing suits or formal clothing. I generally just asks when I'd like to see them wear a tie or be formal, and they always agree.
What about you?
When do dress codes get discriminatory?
16 Opinion