mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-29 21:12:00 +00:00
Fixed empty structs generating bad constructor.
This was fixed previously here:
5fd0fefab6
but somehow got undone in intermediate refactors.
Change-Id: I86e45a3f96f67a2b3d84d44081403baef6798921
This commit is contained in:
@@ -2497,21 +2497,23 @@ class CppGenerator : public BaseGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code_.SetValue("ARG_LIST", arg_list);
|
if (!arg_list.empty()) {
|
||||||
code_.SetValue("INIT_LIST", init_list);
|
code_.SetValue("ARG_LIST", arg_list);
|
||||||
code_ += " {{STRUCT_NAME}}({{ARG_LIST}})";
|
code_.SetValue("INIT_LIST", init_list);
|
||||||
code_ += " : {{INIT_LIST}} {";
|
code_ += " {{STRUCT_NAME}}({{ARG_LIST}})";
|
||||||
padding_id = 0;
|
code_ += " : {{INIT_LIST}} {";
|
||||||
for (auto it = struct_def.fields.vec.begin();
|
padding_id = 0;
|
||||||
it != struct_def.fields.vec.end(); ++it) {
|
for (auto it = struct_def.fields.vec.begin();
|
||||||
const auto &field = **it;
|
it != struct_def.fields.vec.end(); ++it) {
|
||||||
if (field.padding) {
|
const auto &field = **it;
|
||||||
std::string padding;
|
if (field.padding) {
|
||||||
GenPadding(field, &padding, &padding_id, PaddingNoop);
|
std::string padding;
|
||||||
code_ += padding;
|
GenPadding(field, &padding, &padding_id, PaddingNoop);
|
||||||
|
code_ += padding;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
code_ += " }";
|
||||||
}
|
}
|
||||||
code_ += " }";
|
|
||||||
|
|
||||||
// Generate accessor methods of the form:
|
// Generate accessor methods of the form:
|
||||||
// type name() const { return flatbuffers::EndianScalar(name_); }
|
// type name() const { return flatbuffers::EndianScalar(name_); }
|
||||||
|
|||||||
Reference in New Issue
Block a user