diff --git a/td/generate/tl_writer_cpp.cpp b/td/generate/tl_writer_cpp.cpp index 56a682c64..758cfe539 100644 --- a/td/generate/tl_writer_cpp.cpp +++ b/td/generate/tl_writer_cpp.cpp @@ -516,7 +516,13 @@ std::string TD_TL_writer_cpp::gen_fetch_function_begin(const std::string &parser assert(arity == 0); if (parser_type == 0) { - return "\n" + class_name + "::" + class_name + "(" + parser_name + + return "\n" + fetched_type + class_name + "::fetch(" + parser_name + + " &p) {\n" + " return make_tl_object<" + + class_name + + ">(p);\n" + "}\n\n" + + class_name + "::" + class_name + "(" + parser_name + " &p)\n" "#define FAIL(error) p.set_error(error)\n"; } diff --git a/td/generate/tl_writer_h.cpp b/td/generate/tl_writer_h.cpp index 49eaf4982..b96d4cd76 100644 --- a/td/generate/tl_writer_h.cpp +++ b/td/generate/tl_writer_h.cpp @@ -261,13 +261,8 @@ std::string TD_TL_writer_h::gen_fetch_function_begin(const std::string &parser_n if (parser_type == 0) { return "\n" " static " + - fetched_type + "fetch(" + parser_name + - " &p) {\n" - " return make_tl_object<" + - class_name + - ">(p);\n" - " }\n\n" + - " explicit " + class_name + "(" + parser_name + " &p);\n"; + fetched_type + "fetch(" + parser_name + " &p);\n\n" + " explicit " + class_name + "(" + parser_name + + " &p);\n"; } assert(arity == 0);