[Refactoring] Add helper functions for TemplateTypeParameter deduction
fix Issue 11868 - ICE(template.c) on passing `inout const` argument as TemplateTupleParameter
Merge pull request #3064 from 9rnsr/fix11868

[REG2.066a] Issue 11868 - ICE(template.c) on passing `inout const` argument as TemplateTupleParameter