diff options
author | Frank Benkstein <frank@benkstein.net> | 2018-11-01 20:51:25 +0100 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2018-11-01 12:51:25 -0700 |
commit | 91fe9ba93f3bfe31d08bc7b3fa6c7e96a49af44a (patch) | |
tree | 035c8f62ca71e33613d5ece0bf5b4cc8c29debff /include/flatbuffers/idl.h | |
parent | 4c3b6c247d8bb76b524c013e22ecfeb3f83ad680 (diff) | |
download | flatbuffers-91fe9ba93f3bfe31d08bc7b3fa6c7e96a49af44a.tar.gz |
make unions with type aliases more usable (#5019)
Some generic C++ and Rust code is not generated when unions use type
aliases because of potential ambiguity. Actually check for this
ambiguity and only disable offending code only if it is found.
Diffstat (limited to 'include/flatbuffers/idl.h')
-rw-r--r-- | include/flatbuffers/idl.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index c00bdb9c..11427ab8 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -327,7 +327,7 @@ struct EnumVal { }; struct EnumDef : public Definition { - EnumDef() : is_union(false), uses_type_aliases(false) {} + EnumDef() : is_union(false), uses_multiple_type_instances(false) {} EnumVal *ReverseLookup(int64_t enum_idx, bool skip_union_default = true) { for (auto it = vals.vec.begin() + @@ -342,7 +342,9 @@ struct EnumDef : public Definition { SymbolTable<EnumVal> vals; bool is_union; - bool uses_type_aliases; + // Type is a union which uses type aliases where at least one type is + // available under two different names. + bool uses_multiple_type_instances; Type underlying_type; }; |