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:
Stefan F 2022-04-01 22:35:57 +02:00 committed by GitHub
parent c9651b7420
commit 35281dedb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -2273,7 +2273,7 @@ class CppGenerator : public BaseGenerator {
// @TODO: Mby make this decisions more universal? How?
code_.SetValue("U_GET_TYPE",
EscapeKeyword(field.name + UnionTypeFieldSuffix()));
EscapeKeyword(Name(field) + UnionTypeFieldSuffix()));
code_.SetValue("U_ELEMENT_TYPE", WrapInNameSpace(u->defined_namespace,
GetEnumValUse(*u, ev)));
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();
it != struct_def.fields.vec.end(); ++it) {
const auto field = *it;
const auto field_name = field->name + "_";
const auto field_name = Name(*field) + "_";
if (first_in_init_list) {
first_in_init_list = false;