fix crash: template in C++ should be directly set a type