Sema: Don't crash when __try/__except/__finally appears in a template function

We wouldn't transform the compound statement in any of these forms,
causing crashes when it got time to act on them.  Additionally, we
wouldn't check to see if the handler was invalid before deciding whether
or not we should continue acting on the __try.

This fixes PR17584.