@@ -635,6 +635,8 @@ void cpp_gen::visit(const mfast::enum_field_instruction *inst, void *pIndex) {
635635
636636 std::string context = gen_op_context (inst->name (), inst->op_context ());
637637
638+ const mfast::value_storage &init_value = inst->initial_value ();
639+
638640 out_ << " const static " << instruction_type.str () << " \n "
639641 << instruction_variable_name << " (\n "
640642 << " " << get_operator_name (inst) << " ,\n "
@@ -643,8 +645,12 @@ void cpp_gen::visit(const mfast::enum_field_instruction *inst, void *pIndex) {
643645 << " \" " << inst->name () << " \" , // name\n "
644646 << " \" " << inst->ns () << " \" , // ns\n "
645647 << " " << context << " , // opContext\n "
646- << " int_value_storage<uint64_t>("
647- << inst->initial_value ().get <uint64_t >() << " ), // initial_value\n "
648+ << " int_value_storage<uint64_t>(" ;
649+
650+ if (!init_value.is_empty ())
651+ out_ << init_value.get <uint64_t >();
652+
653+ out_ << " ), // initial_value\n "
648654 << " " << elements_variable_name.str () << " , // element names\n "
649655 << " " << values_variable_name << " , // element values\n "
650656 << " " << num_elements_name.str () << " ,// num elements\n "
@@ -702,6 +708,9 @@ void cpp_gen::visit(const mfast::set_field_instruction *inst, void *pIndex)
702708 out_ << " };\n " ;
703709 }
704710 std::string context = gen_op_context (inst->name (), inst->op_context ());
711+
712+ const mfast::value_storage &init_value = inst->initial_value ();
713+
705714 out_ << " const static " << instruction_type.str () << " \n "
706715 << instruction_variable_name << " (\n "
707716 << " " << get_operator_name (inst) << " ,\n "
@@ -710,8 +719,12 @@ void cpp_gen::visit(const mfast::set_field_instruction *inst, void *pIndex)
710719 << " \" " << inst->name () << " \" , // name\n "
711720 << " \" " << inst->ns () << " \" , // ns\n "
712721 << " " << context << " , // opContext\n "
713- << " int_value_storage<uint64_t>("
714- << inst->initial_value ().get <uint64_t >() << " ), // initial_value\n "
722+ << " int_value_storage<uint64_t>(" ;
723+
724+ if (!init_value.is_empty ())
725+ out_ << init_value.get <uint64_t >();
726+
727+ out_ << " ), // initial_value\n "
715728 << " " << elements_variable_name.str () << " , // element names\n "
716729 << " " << num_elements_name.str () << " ,// num elements\n "
717730 << " nullptr, // ref_instruction\n "
0 commit comments