diff --git a/src/script_opt/CPP/InitsInfo.cc b/src/script_opt/CPP/InitsInfo.cc index d63e1a45de..3954a39b13 100644 --- a/src/script_opt/CPP/InitsInfo.cc +++ b/src/script_opt/CPP/InitsInfo.cc @@ -299,9 +299,12 @@ void FuncConstInfo::InitializerVals(std::vector& ivs) const { } } -void TypeConstInfo::InitializerVals(std::vector& ivs) const { - auto& t = tv->GetType()->AsTypeType()->GetType(); - ivs.emplace_back(Fmt(t->Tag())); +TypeConstInfo::TypeConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v) { + auto tv = v->AsTypeVal(); + auto t = tv->GetType()->AsTypeType()->GetType(); + auto gi = c->RegisterType(t); + type = c->TypeOffset(t); + init_cohort = max(init_cohort, gi->InitCohort() + 1); } AttrInfo::AttrInfo(CPPCompile* _c, const AttrPtr& attr) : CompoundItemInfo(_c) { diff --git a/src/script_opt/CPP/InitsInfo.h b/src/script_opt/CPP/InitsInfo.h index 54c4600af1..a86da4e822 100644 --- a/src/script_opt/CPP/InitsInfo.h +++ b/src/script_opt/CPP/InitsInfo.h @@ -469,12 +469,7 @@ private: class TypeConstInfo : public CompoundItemInfo { public: - TypeConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v), tv(v->AsTypeVal()) {} - - void InitializerVals(std::vector& ivs) const override; - -private: - TypeVal* tv; + TypeConstInfo(CPPCompile* _c, ValPtr v); }; // Initialization information for single attributes and sets of attributes. diff --git a/src/script_opt/CPP/RuntimeInits.cc b/src/script_opt/CPP/RuntimeInits.cc index 6efdad27f4..6bd6a1011e 100644 --- a/src/script_opt/CPP/RuntimeInits.cc +++ b/src/script_opt/CPP/RuntimeInits.cc @@ -154,8 +154,7 @@ void CPP_IndexedInits::Generate(InitsManager* im, std::vector& iv template void CPP_IndexedInits::Generate(InitsManager* im, std::vector& ivec, int offset, ValElemVec& init_vals) const { - auto bt = base_type(static_cast(init_vals[0])); - auto t = make_intrusive(bt); + auto t = make_intrusive(im->Types(init_vals[0])); ivec[offset] = make_intrusive(t); }