flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

Generated duplicit associated value for enum variant

Open DolajoCZ opened this issue 9 months ago • 0 comments

For enums where you define values for some variants can flatc generate same value for multiple variants.

Simple example:

enum Color : byte { Red = 4, Green = 3, Blue }

In this case is Red = 4 and flatc generate Blue=4. Then if you serialize Color:Blue and then deserialize back you get Color:Red.

It should generate next available value, not only next value from previous as it is write now. Or at least some error/warning during compilation of fbs schema.

DolajoCZ avatar Apr 24 '25 13:04 DolajoCZ