Fix flatc code gen.

Mutable functions should return a non-const reference to the member variable.

Change-Id: I833077d2c9a38a5d71868e43aca6b250d79b6625
This commit is contained in:
Wouter van Oortmerssen
2017-03-29 11:51:20 -07:00
parent cffd187fc7
commit b4bb1b103f
3 changed files with 3 additions and 1 deletions

View File

@@ -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",