diff --git a/App/lib/core/Gen/Class/ClassGenDef.vp b/App/lib/core/Gen/Class/ClassGenDef.vp index dc97add..31cac28 100644 --- a/App/lib/core/Gen/Class/ClassGenDef.vp +++ b/App/lib/core/Gen/Class/ClassGenDef.vp @@ -154,6 +154,16 @@ novirtual class ClassGenDef(ClassGenBase.ClassGenBase): # 必须补设 IsPacked——否则跨模块 stub 注入(ensure_struct_def # _in_module)按 entry.IsPacked 判定 packed 时读 0 → stub 非 packed。 existing.IsPacked = 1 + # 字段类型补齐(与下方"全新定义"路径同口径):值类型字段(结构体本体 / + # 结构体数组)必须在当前模块有**完整定义**,只给 opaque 会让本类 unsized + # ⇒ 本模块内对本类做带字段下标的 GEP 时 llc 报 + # "base element of getelementptr must be sized"(现场:includes/ + # condition.vp 的 Condition{cond_var: CONDITION_VARIABLE, + # cs: CRITICAL_SECTION},后两者定义在 w32/win32sync.vp,新近由 + # `t.CTypedef = VOIDPTR` 改成 class)。指针字段只需 opaque 声明。 + # 本条路径是 includes 在 Phase A 预注册、Phase B 重新翻译时走的 + # 早退分支(不经过下方全新定义路径的字段扫描循环)。 + self.Gen.StructGen._ensure_field_types_in_module(pool, trans.Module, existing.Ty) align_ex: int = self.Gen.ClassGenBase._class_aligned_value(cd.decorator_list) if align_ex > 0 and existing.Align == 0: existing.Align = align_ex