fix Issue 9050 - Too early instantiation of template structs
Merge pull request #2851 from 9rnsr/fix9050

Issue 9050 - Too early instantiation of template structs