Add instantiation checking of function templates.

Still some remaining issues:
 - Emitting code, esp. C++ (must emit each instantiation due to On extra argument issue).
 - Check not triggered by function referencing (such as NewtonSolve() argument).