Fix generic_statistics handling of template instantiation.  #3496.