mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-01 17:57:25 +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:
parent
fe5e4c71c5
commit
1d3afb90c5
10 changed files with 1004 additions and 17 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue