Skip to content

Commit 305c2b6

Browse files
author
Daniel Kroening
committed
union tags in anonymous members with union type
1 parent 2542d0d commit 305c2b6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,14 @@ void cpp_typecheckt::convert_anon_struct_union_member(
14581458
cpp_scopes.current_scope().prefix+
14591459
base_name.c_str();
14601460

1461-
const symbol_typet symbol_type(struct_union_symbol.name);
1461+
typet compound_type;
14621462

1463-
struct_typet::componentt component(identifier, symbol_type);
1463+
if(struct_union_symbol.type.id() == ID_union)
1464+
compound_type = union_tag_typet(struct_union_symbol.name);
1465+
else
1466+
compound_type = symbol_typet(struct_union_symbol.name);
1467+
1468+
struct_typet::componentt component(identifier, compound_type);
14641469
component.set_access(access);
14651470
component.set_base_name(base_name);
14661471
component.set_pretty_name(base_name);

0 commit comments

Comments
 (0)