fix Issue 12651 - TemplateArgsOf accepts nonsensical arguments
Merge pull request #3502 from 9rnsr/fix12651

Issue 12651 - TemplateArgsOf accepts nonsensical arguments