diff --git a/App/lib/core/Gen/Type/TypeGenResolve.vp b/App/lib/core/Gen/Type/TypeGenResolve.vp index 5cac4cd..0b35574 100644 --- a/App/lib/core/Gen/Type/TypeGenResolve.vp +++ b/App/lib/core/Gen/Type/TypeGenResolve.vp @@ -3118,11 +3118,17 @@ novirtual class TypeGenResolve(TypeGenBase.TypeGenBase): # 解析结果本身即 void(如 `typedef 不透明结构体 = void` 的那个名字, # 或经 typedef 兜底解析出的 void)⇒ 与 CPtr 合并即 void* = i8*, # 与上方 other_is_cvoid 分支同一结论(否则会拼出非法的 Ptr(void))。 - match other_ty: - case llvmlite.LLVMType.Void(): - return llvmlite.Ptr(pool, llvmlite.Int8(pool)) - case _: - pass + # **必须守 None**:`X*`(parser 展开为 BinOp `X | t.CPtr`)在 Phase 1a + # prescan 时 X 很可能尚未注册(类定义在函数之后),resolve 返回 None; + # 对 None 做 case 匹配会按 REnum tag 解引用空指针(ASan 现场:address 0x0 + # READ,栈 _prescan_funcdef_signatures → resolve_annotation_type)。 + # None 交由下方既有 `if other_ty is None:` 分支处理。 + if other_ty is not None: + match other_ty: + case llvmlite.LLVMType.Void(): + return llvmlite.Ptr(pool, llvmlite.Int8(pool)) + case _: + pass # 仅裸名(Name)场景验证解析结果必须是已注册 struct: # 损坏节点可能解析出基础类型垃圾(如 Int8 → Ptr(i8))。 # Attribute 场景(Module.Class / t.XXX)resolve 结果直接可用