fix Issue 5988 - Template accepts instantiating an already-instantiated template type
Merge pull request #2051 from 9rnsr/fix5988

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