fix Issue 10296 - Nested template function call and purity inference bug