committed by
Ryan Hunt
parent
0ebcf99d31
commit
f9b8512dc2
@@ -357,7 +357,21 @@ impl Source for Enum {
|
||||
out.open_brace();
|
||||
}
|
||||
|
||||
// C++ allows accessing only common initial sequence of union
|
||||
// branches so we need to wrap tag into an anonymous struct
|
||||
let wrap_tag = config.language == Language::Cxx && !separate_tag;
|
||||
|
||||
if wrap_tag {
|
||||
out.write("struct");
|
||||
out.open_brace();
|
||||
}
|
||||
|
||||
write!(out, "{} tag;", enum_name);
|
||||
|
||||
if wrap_tag {
|
||||
out.close_brace(true);
|
||||
}
|
||||
|
||||
out.new_line();
|
||||
|
||||
if separate_tag {
|
||||
|
||||
@@ -34,7 +34,9 @@ union DisplayItem {
|
||||
Rect bounds;
|
||||
};
|
||||
|
||||
Tag tag;
|
||||
struct {
|
||||
Tag tag;
|
||||
};
|
||||
Fill_Body fill;
|
||||
Image_Body image;
|
||||
};
|
||||
|
||||
@@ -56,7 +56,9 @@ union F {
|
||||
int16_t y;
|
||||
};
|
||||
|
||||
Tag tag;
|
||||
struct {
|
||||
Tag tag;
|
||||
};
|
||||
Foo_Body foo;
|
||||
Bar_Body bar;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user