Explorar o código

[cpp] Remove StaticCast of fixed override because it might be wrong

Hugh %!s(int64=9) %!d(string=hai) anos
pai
achega
62f442f416
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/generators/gencpp.ml

+ 3 - 0
src/generators/gencpp.ml

@@ -2715,8 +2715,11 @@ let retype_expression ctx request_type function_args expression_tree forInjectio
 
 
          | _ -> cppExpr
          | _ -> cppExpr
       end else match cppExpr.cppexpr, cppExpr.cpptype, return_type with
       end else match cppExpr.cppexpr, cppExpr.cpptype, return_type with
+         (*  This detection of cpp_is_fixed_override and the real type is wrong then
+             the code explicitly casts the return value of a function
          | CppCall( FuncInstance(_,false,_), _ ), _,_ when cpp_is_fixed_override cppExpr.cpptype return_type
          | CppCall( FuncInstance(_,false,_), _ ), _,_ when cpp_is_fixed_override cppExpr.cpptype return_type
               -> mk_cppexpr (CppCastStatic(cppExpr,return_type)) return_type
               -> mk_cppexpr (CppCastStatic(cppExpr,return_type)) return_type
+         *)
          | _, TCppObjC(k), TCppDynamic
          | _, TCppObjC(k), TCppDynamic
               -> mk_cppexpr (CppCast(cppExpr,TCppDynamic)) return_type
               -> mk_cppexpr (CppCast(cppExpr,TCppDynamic)) return_type
          | _ -> cppExpr
          | _ -> cppExpr