mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
feat(C++): Support underlying_type for union (#7954)
* feat(C++): support underlying type for union * chore: add conform checks for underlying type changes
This commit is contained in:
@@ -841,6 +841,15 @@ void ParseUnionTest() {
|
||||
"table B { e:U; } root_type B;"
|
||||
"{ e_type: N_A, e: {} }"),
|
||||
true);
|
||||
|
||||
// Test union underlying type
|
||||
const char *source = "table A {} table B {} union U : int {A, B} table C {test_union: U; test_vector_of_union: [U];}";
|
||||
flatbuffers::Parser parser3;
|
||||
parser3.opts.lang_to_generate = flatbuffers::IDLOptions::kCpp;
|
||||
TEST_EQ(parser3.Parse(source), true);
|
||||
|
||||
parser3.opts.lang_to_generate &= flatbuffers::IDLOptions::kJava;
|
||||
TEST_EQ(parser3.Parse(source), false);
|
||||
}
|
||||
|
||||
void ValidSameNameDifferentNamespaceTest() {
|
||||
|
||||
Reference in New Issue
Block a user