Improve 'is used as a type' template error

If a template instantiation fails, a spurious 'XXX is used as a type' error
is generated. Suppress it.
Also, when a constraint fails, change the instantiation error into a
supplemental error message.