It's pretty much up to you what to do. There is no one thing you should always do in such situations. It entirely depends on the circumstances and only you can understand those. I personally think you should confess. Keeping that kind of emotion pent up inside you is more than anyone should expect/demand of you. There is usually a risk involved with everything worth going for, and I find that being rejected is better than not knowing if it could have been, even if it hurts. You'll have to ask yourself if the risk is worth it, and only you find the answer to that question.