1. Be handsome
2. Be attractive
3. Don't be unattractive
Joking aside, I think you are misunderstanding me.
I don't suggest anybody should be fired for asking someone for a date. I'm saying that company policy can give you an easy way to say "no" to a date: "Sorry, I don't want to jeopardize my career, you know company policy.". Ideally, the person asking you out will accept your rejection, and there's no need to fire anyone.
Easily said, but impossible to put into practice. Have you ever tried to get a woman to make her intentions clear? Apart from being seen as insulting, it's an impossible condition to place on social interactions between men and women, where a woman's inalienable right to be vague and ambiguous is an essential component of the dating game.
Which is possible given that a lot of the most promising developers are young, I still don't agree with it. People need to be able to make mistakes and corporate culture is strangling them.