I am providing following proto file to flatbuffer compiler to generate .fbs file.
File: test.proto
message A {
optional int32 afoo = 1;
message B {
optional int32 bfoo_ = 1;
}
optional B bfoo= 2;
}
message C {
optional int32 abar = 1;
message B {
optional int32 bbar_ = 1;
}
optional B bbar = 2;
}
After this i ran: flatc --proto test.proto, which will generate .fbs file
File: test.fbs // Generated from test.proto
namespace ;
table A {
afoo:int;
bfoo:_A.B;
}
namespace _A;
table B {
bfoo_:int;
}
namespace ;
table C {
abar:int;
bbar:_C.B;
}
namespace _C;
table B {
bbar_:int;
}
Point to note here is "B" has been pulled out to global namespace After that i ran flat -cpp test.proto, which eventually generate incorrect header file. Contains two definitions of B
struct B FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table