Please use `isTemplateInstance` instead of `dynamic_cast`.