As long as they weren't dangerous about it, I think it's no harm (except maybe to one's ego).
I had someone pass me halfway up the hill to Pepperdine once. I yelled "Nice job" as he passed me, went two gears harder and caught up with him and passed him. I waited at the top to give him his props but he snubbed me and rode on....
I love getting passed by folks becuase it's a sign to tell you you need to keep improving other people though may not take it so lightly.