If you have many more classes with him, I don't think it's a really good idea. If you won't have him as a professor anymore, then why not. But still, it's kind of awkward. At least, to me.
I used to have a crush on one of my teachers, I still think he's drop dead sexy, but ehhh, now I look back and I think wtf was wrong with me to even think it was a good idea to get closer? I never did get closer, but back then I was convinced it would be a good idea. Pfffft

I was so young and retarded lol This sh?t would have never worked anyway