fix Issue 6312 - template instance cannot use argument from enclosing template