瀏覽代碼

[cpp] Do not StaticCast references or pointers

hughsando 9 年之前
父節點
當前提交
eac745857d
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      src/generators/gencpp.ml

+ 10 - 6
src/generators/gencpp.ml

@@ -2076,12 +2076,16 @@ let is_array_splice_call obj member =
 ;;
 
 let cpp_can_static_cast funcType inferredType =
-   match inferredType with
-   | TCppInst _
-   | TCppClass
-   | TCppEnum _
-      -> (tcpp_to_string funcType) <> (tcpp_to_string inferredType)
-   | _ -> false
+   match funcType with
+   | TCppReference(_) | TCppStar(_) -> false
+   | _ ->
+      (match inferredType with
+      | TCppInst _
+      | TCppClass
+      | TCppEnum _
+         -> (tcpp_to_string funcType) <> (tcpp_to_string inferredType)
+      | _ -> false
+   )
 ;;
 
 let cpp_member_name_of member =