mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 15:46:10 +00:00
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.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
4c3b6c247d
commit
91fe9ba93f
@@ -18,6 +18,9 @@ enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, }
|
||||
|
||||
union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
|
||||
|
||||
union AnyUniqueAliases { M: Monster, T: TestSimpleTableWithEnum, M2: MyGame.Example2.Monster }
|
||||
union AnyAmbiguousAliases { M1: Monster, M2: Monster, M3: Monster }
|
||||
|
||||
struct Test { a:short; b:byte; }
|
||||
|
||||
table TestSimpleTableWithEnum (csharp_partial, private) {
|
||||
@@ -94,6 +97,8 @@ table Monster {
|
||||
vector_of_co_owning_references:[ulong](id:40, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"default_ptr_type", cpp_ptr_type_get:".get()"); //was shared_ptr
|
||||
non_owning_reference:ulong(id:41, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
|
||||
vector_of_non_owning_references:[ulong](id:42, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
|
||||
any_unique:AnyUniqueAliases(id:44);
|
||||
any_ambiguous:AnyAmbiguousAliases (id:46);
|
||||
}
|
||||
|
||||
table TypeAliases {
|
||||
|
||||
Reference in New Issue
Block a user