浏览代码

Merge pull request #688 from bmx-ng/task/global-init-fptr-cast

Ensure global function pointer init is cast.
Brucey 7 月之前
父节点
当前提交
b40385262b
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      ctranslator.bmx

+ 2 - 2
ctranslator.bmx

@@ -1011,9 +1011,9 @@ t:+"NULLNULLNULL"
 				If gdecl.init Then
 					If TFunctionPtrType(gdecl.ty) Then
 						If TInvokeExpr(gdecl.init) And Not TInvokeExpr(gdecl.init).invokedWithBraces Then
-							glob :+ TInvokeExpr(gdecl.init).decl.munged
+							glob :+ TransCast(TFunctionPtrType(gdecl.ty)) + TInvokeExpr(gdecl.init).decl.munged
 						Else
-							glob :+ gdecl.init.Trans()
+							glob :+ TransCast(TFunctionPtrType(gdecl.ty)) + gdecl.init.Trans()
 						End If
 					Else If Not TConstExpr(gdecl.init) And Not (gdecl.attrs & DECL_INITONLY) Then
 						' for non const, we need to add an initialiser