Fix flatc code gen.
Mutable functions should return a non-const reference to the member variable. Change-Id: I833077d2c9a38a5d71868e43aca6b250d79b6625
This commit is contained in:
parent
cffd187fc7
commit
b4bb1b103f
|
@ -1928,6 +1928,8 @@ class CppGenerator : public BaseGenerator {
|
|||
code_ += " }";
|
||||
|
||||
if (parser_.opts.mutable_buffer) {
|
||||
auto mut_field_type = GenTypeGet(field.value.type, " ", "", " &", true);
|
||||
code_.SetValue("FIELD_TYPE", mut_field_type);
|
||||
if (is_scalar) {
|
||||
code_.SetValue("ARG", GenTypeBasic(field.value.type, true));
|
||||
code_.SetValue("FIELD_VALUE",
|
||||
|
|
Binary file not shown.
|
@ -243,7 +243,7 @@ MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
|
|||
const Test &test3() const {
|
||||
return test3_;
|
||||
}
|
||||
const Test &mutable_test3() {
|
||||
Test &mutable_test3() {
|
||||
return test3_;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue