fix Issue 5988 - Template accepts instantiating an already-instantiated template type