@@ -93,6 +93,9 @@ void c_typecheck_baset::typecheck_type(typet &type)
9393 typecheck_symbol_type (to_symbol_type (type));
9494 else if (type.id () == ID_typedef_type)
9595 typecheck_typedef_type (type);
96+ else if (type.id () == ID_union_tag)
97+ {
98+ }
9699 else if (type.id ()==ID_vector)
97100 typecheck_vector_type (to_vector_type (type));
98101 else if (type.id ()==ID_custom_unsignedbv ||
@@ -795,12 +798,24 @@ void c_typecheck_baset::typecheck_compound_type(struct_union_typet &type)
795798 }
796799 }
797800
798- symbol_typet symbol_type (identifier);
799- symbol_type.add_source_location ()=type.source_location ();
801+ if (type.id () == ID_union)
802+ {
803+ union_tag_typet tag_type (identifier);
804+ tag_type.add_source_location () = type.source_location ();
805+
806+ c_qualifierst original_qualifiers (type);
807+ type.swap (tag_type);
808+ original_qualifiers.write (type);
809+ }
810+ else
811+ {
812+ symbol_typet symbol_type (identifier);
813+ symbol_type.add_source_location () = type.source_location ();
800814
801- c_qualifierst original_qualifiers (type);
802- type.swap (symbol_type);
803- original_qualifiers.write (type);
815+ c_qualifierst original_qualifiers (type);
816+ type.swap (symbol_type);
817+ original_qualifiers.write (type);
818+ }
804819}
805820
806821void c_typecheck_baset::typecheck_compound_body (
0 commit comments