flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

code generation of convenient C++ "CreateXXX" member functions is broken!

Open fleapapa opened this issue 10 years ago • 1 comments

For example, currently it generates this wrong code:

return CreateStat(_fbb, mac ? 0 : _fbb.CreateVector<uint8_t>(*mac), ntx, nrx, nerr);

Instead, it should generate this code:

return CreateStat(_fbb, mac ?_fbb.CreateVector<uint8_t>(*mac): 0, ntx, nrx, nerr);

The bug starts at line 929 and 932 in flatbuffers/src/idl_gen_cpp.cpp.

fleapapa avatar Aug 06 '16 02:08 fleapapa

Thanks for reporting! That apparently was never tested.. I made a quick fix here: https://github.com/google/flatbuffers/commit/3eebba789f6447b342a308b0ad38ed0a6fb51de4

ghost avatar Aug 08 '16 19:08 ghost