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.
Merge pull request #1799 from donc/isusedasatype

Supress spurious 'is used as a type' template error message