@@ -437,7 +437,7 @@ void cpp_typecheckt::default_assignop_value(
437437 declarator.value ().add_source_location ()=source_location;
438438 declarator.value ().id (ID_code);
439439 declarator.value ().set (ID_statement, ID_block);
440- declarator.value ().type ()= code_typet ();
440+ declarator.value ().type () = code_typet ({}, empty_typet () );
441441
442442 exprt &block=declarator.value ();
443443
@@ -484,13 +484,11 @@ void cpp_typecheckt::default_assignop_value(
484484 continue ;
485485 }
486486
487- mp_integer size;
488- bool to_int=to_integer (size_expr, size);
489- CHECK_RETURN (!to_int);
490- CHECK_RETURN (size>=0 );
487+ const auto size = numeric_cast<mp_integer>(size_expr);
488+ CHECK_RETURN (!size.has_value ());
489+ CHECK_RETURN (*size >= 0 );
491490
492- exprt::operandst empty_operands;
493- for (mp_integer i=0 ; i < size; ++i)
491+ for (mp_integer i = 0 ; i < *size; ++i)
494492 copy_array (source_location, mem_name, i, arg_name, block);
495493 }
496494 else
@@ -503,7 +501,7 @@ void cpp_typecheckt::default_assignop_value(
503501 ret_code.operands ().push_back (exprt (ID_dereference));
504502 ret_code.op0 ().operands ().push_back (exprt (" cpp-this" ));
505503 ret_code.set (ID_statement, ID_return);
506- ret_code.type ()= code_typet ();
504+ ret_code.type () = code_typet ({}, empty_typet () );
507505}
508506
509507// / Check a constructor initialization-list. An initializer has to be a data
0 commit comments