diff --git a/infer/src/clang/cTrans_utils.ml b/infer/src/clang/cTrans_utils.ml index a3ae711c2..28610937f 100644 --- a/infer/src/clang/cTrans_utils.ml +++ b/infer/src/clang/cTrans_utils.ml @@ -398,7 +398,7 @@ let dereference_value_from_result sil_loc trans_result ~strip_pointer = let cast_operation context cast_kind exps cast_typ sil_loc is_objc_bridged = let (exp, typ) = extract_exp_from_list exps "" in let exp_typ = match cast_kind with - | `UncheckedDerivedToBase -> typ (* This cast ignores change of type *) + | `UncheckedDerivedToBase | `DerivedToBase -> typ (* These casts ignore change of type *) | _ -> cast_typ (* by default use the return type of cast expr *) in if is_objc_bridged then let id, instr, exp = create_cast_instrs context exp typ cast_typ sil_loc in diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot index 1ebc9aa7f..3a6b60783 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance.cpp.dot @@ -3,7 +3,7 @@ digraph iCFG { 24 -> 23 ; -23 [label="23: DeclStmt \n n$13=_fun___new(sizeof(class Sub ):unsigned long ) [line 23]\n *&s1:class Base *=n$13 [line 23]\n REMOVE_TEMPS(n$13); [line 23]\n " shape="box"] +23 [label="23: DeclStmt \n n$13=_fun___new(sizeof(class Sub ):unsigned long ) [line 23]\n *&s1:class Sub *=n$13 [line 23]\n REMOVE_TEMPS(n$13); [line 23]\n " shape="box"] 23 -> 22 ; diff --git a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance_field.cpp.dot b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance_field.cpp.dot index f50b6d232..1c839e857 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/types/inheritance_field.cpp.dot +++ b/infer/tests/codetoanalyze/cpp/frontend/types/inheritance_field.cpp.dot @@ -3,7 +3,7 @@ digraph iCFG { 41 -> 40 ; -40 [label="40: DeclStmt \n n$2=*&s:class Sub * [line 68]\n *&b:struct Base1 *=n$2 [line 68]\n REMOVE_TEMPS(n$2); [line 68]\n NULLIFY(&s,false); [line 68]\n " shape="box"] +40 [label="40: DeclStmt \n n$2=*&s:class Sub * [line 68]\n *&b:class Sub *=n$2 [line 68]\n REMOVE_TEMPS(n$2); [line 68]\n NULLIFY(&s,false); [line 68]\n " shape="box"] 40 -> 39 ; @@ -75,7 +75,7 @@ digraph iCFG { 22 -> 21 ; -21 [label="21: DeclStmt \n *&b:struct Base1 &=&s [line 45]\n " shape="box"] +21 [label="21: DeclStmt \n *&b:class Sub &=&s [line 45]\n " shape="box"] 21 -> 20 ; @@ -94,7 +94,7 @@ digraph iCFG { 17 -> 16 ; -16 [label="16: DeclStmt \n n$2=*&s:class Sub * [line 39]\n *&b:struct Base1 *=n$2 [line 39]\n REMOVE_TEMPS(n$2); [line 39]\n NULLIFY(&s,false); [line 39]\n " shape="box"] +16 [label="16: DeclStmt \n n$2=*&s:class Sub * [line 39]\n *&b:class Sub *=n$2 [line 39]\n REMOVE_TEMPS(n$2); [line 39]\n NULLIFY(&s,false); [line 39]\n " shape="box"] 16 -> 15 ;