Replying myself to my question.
Even if the flow of control is supposed to stop because of the exception, as
the template is declared to return a typedesc, the last instruction **must** be
a typedesc else the compiler prints another error... So to get the expected
behaviour, the correct last template is now:
template final_sort2(v: typed): typedesc =
raise newException(Exception, "Incompatible type: " & $v)
AST_null
Run
