Fixed empty structs generating illegal constructor in C++.
Change-Id: I60418d597b497c3cfa655ad76b3128351e9139f2
This commit is contained in:
parent
b9efbf6a3d
commit
5fd0fefab6
|
@ -1354,6 +1354,7 @@ class CppGenerator : public BaseGenerator {
|
||||||
code += struct_def.name + ")); }\n";
|
code += struct_def.name + ")); }\n";
|
||||||
|
|
||||||
// Generate a constructor that takes all fields as arguments.
|
// Generate a constructor that takes all fields as arguments.
|
||||||
|
if (struct_def.fields.vec.size()) {
|
||||||
code += " " + struct_def.name + "(";
|
code += " " + struct_def.name + "(";
|
||||||
for (auto it = struct_def.fields.vec.begin();
|
for (auto it = struct_def.fields.vec.begin();
|
||||||
it != struct_def.fields.vec.end(); ++it) {
|
it != struct_def.fields.vec.end(); ++it) {
|
||||||
|
@ -1378,7 +1379,6 @@ class CppGenerator : public BaseGenerator {
|
||||||
}
|
}
|
||||||
GenPadding(field, code, padding_id, PaddingInitializer);
|
GenPadding(field, code, padding_id, PaddingInitializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
code += " {";
|
code += " {";
|
||||||
padding_id = 0;
|
padding_id = 0;
|
||||||
for (auto it = struct_def.fields.vec.begin();
|
for (auto it = struct_def.fields.vec.begin();
|
||||||
|
@ -1387,6 +1387,7 @@ class CppGenerator : public BaseGenerator {
|
||||||
GenPadding(field, code, padding_id, PaddingDeclaration);
|
GenPadding(field, code, padding_id, PaddingDeclaration);
|
||||||
}
|
}
|
||||||
code += " }\n\n";
|
code += " }\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
// 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_); }
|
||||||
|
|
Loading…
Reference in New Issue