Fix for [C++] flatc generates invalid Code in the default constructor for structs, when --cpp-field-case-style is used #7209 (#7211)
* Typo in flatc options (warning-as-errors instead of warnings-as-errors) * VerifySizePrefixed (reflection::Schema) and GetAnySizePrefixedRoot added * some review comments * more review comments * Fix for https://github.com/google/flatbuffers/issues/7209 * Fixes [C++] flatc generates invalid Code for union field accessors, when --cpp-field-case-style is used #7210
This commit is contained in:
parent
c9651b7420
commit
35281dedb5
|
@ -2273,7 +2273,7 @@ class CppGenerator : public BaseGenerator {
|
||||||
|
|
||||||
// @TODO: Mby make this decisions more universal? How?
|
// @TODO: Mby make this decisions more universal? How?
|
||||||
code_.SetValue("U_GET_TYPE",
|
code_.SetValue("U_GET_TYPE",
|
||||||
EscapeKeyword(field.name + UnionTypeFieldSuffix()));
|
EscapeKeyword(Name(field) + UnionTypeFieldSuffix()));
|
||||||
code_.SetValue("U_ELEMENT_TYPE", WrapInNameSpace(u->defined_namespace,
|
code_.SetValue("U_ELEMENT_TYPE", WrapInNameSpace(u->defined_namespace,
|
||||||
GetEnumValUse(*u, ev)));
|
GetEnumValUse(*u, ev)));
|
||||||
code_.SetValue("U_FIELD_TYPE", "const " + full_struct_name + " *");
|
code_.SetValue("U_FIELD_TYPE", "const " + full_struct_name + " *");
|
||||||
|
@ -3466,7 +3466,7 @@ class CppGenerator : public BaseGenerator {
|
||||||
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) {
|
||||||
const auto field = *it;
|
const auto field = *it;
|
||||||
const auto field_name = field->name + "_";
|
const auto field_name = Name(*field) + "_";
|
||||||
|
|
||||||
if (first_in_init_list) {
|
if (first_in_init_list) {
|
||||||
first_in_init_list = false;
|
first_in_init_list = false;
|
||||||
|
|
Loading…
Reference in New Issue