@@ -722,9 +722,7 @@ void cpp_typecheckt::typecheck_expr_address_of(exprt &expr)
722722 // we take the address of the method.
723723 assert (expr.op0 ().id ()==ID_member);
724724 exprt symb=cpp_symbol_expr (lookup (expr.op0 ().get (ID_component_name)));
725- exprt address (ID_address_of, typet (ID_pointer));
726- address.copy_to_operands (symb);
727- address.type ().subtype ()=symb.type ();
725+ address_of_exprt address (symb, pointer_type (symb.type ()));
728726 address.set (ID_C_implicit, true );
729727 expr.op0 ().swap (address);
730728 }
@@ -2255,10 +2253,8 @@ void cpp_typecheckt::typecheck_side_effect_function_call(
22552253 if (operand.type ().id ()!=ID_pointer &&
22562254 operand.type ()==argument.type ().subtype ())
22572255 {
2258- exprt tmp (ID_address_of, typet (ID_pointer));
2259- tmp.type ().subtype ()=operand.type ();
2256+ exprt tmp=address_of_exprt (operand, pointer_type (operand.type ()));
22602257 tmp.add_source_location ()=operand.source_location ();
2261- tmp.move_to_operands (operand);
22622258 operand.swap (tmp);
22632259 }
22642260 }
@@ -2671,9 +2667,8 @@ void cpp_typecheckt::convert_pmop(exprt &expr)
26712667 else
26722668 {
26732669 assert (expr.op0 ().get_bool (ID_C_lvalue));
2674- exprt address_of (ID_address_of, typet (ID_pointer));
2675- address_of.copy_to_operands (expr.op0 ());
2676- address_of.type ().subtype ()=address_of.op0 ().type ();
2670+ exprt address_of=
2671+ address_of_exprt (expr.op0 (), pointer_type (expr.op0 ().type ()));
26772672 expr.op0 ().swap (address_of);
26782673 }
26792674 }
0 commit comments