@@ -337,9 +337,13 @@ exprt cpp_typecheck_resolvet::convert_identifier(
337
337
{
338
338
e.type ()=c_enum_tag_typet (symbol.name );
339
339
}
340
- else // will need to do struct, union
340
+ else if (symbol. type . id () == ID_struct)
341
341
{
342
- e.type ()=symbol_typet (symbol.name );
342
+ e.type () = struct_tag_typet (symbol.name );
343
+ }
344
+ else if (symbol.type .id () == ID_union)
345
+ {
346
+ e.type () = union_tag_typet (symbol.name );
343
347
}
344
348
}
345
349
else if (symbol.is_macro )
@@ -908,7 +912,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
908
912
cpp_typecheck.cpp_scopes .current_scope ().print (std::cout);
909
913
std::cout << " X: " << id_set.size () << ' \n ' ;
910
914
#endif
911
- symbol_typet instance=
915
+ struct_tag_typet instance =
912
916
disambiguate_template_classes (final_base_name, id_set, template_args);
913
917
914
918
instance.add_source_location ()=source_location;
@@ -954,7 +958,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
954
958
// the "::" triggers template elaboration
955
959
if (!cpp_typecheck.cpp_scopes .current_scope ().class_identifier .empty ())
956
960
{
957
- symbol_typet instance (
961
+ struct_tag_typet instance (
958
962
cpp_typecheck.cpp_scopes .current_scope ().class_identifier );
959
963
cpp_typecheck.elaborate_class_template (instance);
960
964
}
@@ -996,7 +1000,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
996
1000
}
997
1001
998
1002
// / disambiguate partial specialization
999
- symbol_typet cpp_typecheck_resolvet::disambiguate_template_classes (
1003
+ struct_tag_typet cpp_typecheck_resolvet::disambiguate_template_classes (
1000
1004
const irep_idt &base_name,
1001
1005
const cpp_scopest::id_sett &id_set,
1002
1006
const cpp_template_args_non_tct &full_template_args)
@@ -1192,7 +1196,7 @@ symbol_typet cpp_typecheck_resolvet::disambiguate_template_classes(
1192
1196
throw 0;
1193
1197
}
1194
1198
1195
- symbol_typet result(instance.name);
1199
+ struct_tag_typet result(instance.name);
1196
1200
result.add_source_location()=source_location;
1197
1201
1198
1202
return result;
@@ -1206,7 +1210,7 @@ symbol_typet cpp_typecheck_resolvet::disambiguate_template_classes(
1206
1210
match.specialization_args ,
1207
1211
match.full_args );
1208
1212
1209
- symbol_typet result (instance.name );
1213
+ struct_tag_typet result (instance.name );
1210
1214
result.add_source_location ()=source_location;
1211
1215
1212
1216
return result;
@@ -2072,7 +2076,7 @@ void cpp_typecheck_resolvet::apply_template_args(
2072
2076
template_args_tc,
2073
2077
template_args_tc);
2074
2078
2075
- expr= exprt (ID_type, symbol_typet (new_symbol.name ));
2079
+ expr = type_exprt ( struct_tag_typet (new_symbol.name ));
2076
2080
expr.add_source_location ()=source_location;
2077
2081
}
2078
2082
else
@@ -2208,21 +2212,7 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
2208
2212
irep_idt identifier=id.identifier ;
2209
2213
2210
2214
if (id.is_member )
2211
- {
2212
- struct_typet struct_type=
2213
- static_cast <const struct_typet &>(
2214
- cpp_typecheck.lookup (id.class_identifier ).type );
2215
- const exprt pcomp=struct_type.get_component (identifier);
2216
- assert (pcomp.is_not_nil ());
2217
- assert (pcomp.get_bool (ID_is_type));
2218
- const typet &type=pcomp.type ();
2219
- assert (type.id ()!=ID_struct);
2220
-
2221
- if (type.id () == ID_symbol_type)
2222
- identifier = to_symbol_type (type).get_identifier ();
2223
- else
2224
- continue ;
2225
- }
2215
+ continue ;
2226
2216
2227
2217
while (true )
2228
2218
{
@@ -2240,8 +2230,6 @@ void cpp_typecheck_resolvet::filter_for_named_scopes(
2240
2230
new_set.insert (&class_id);
2241
2231
break ;
2242
2232
}
2243
- else if (symbol.type .id () == ID_symbol_type)
2244
- identifier = to_symbol_type (symbol.type ).get_identifier ();
2245
2233
else
2246
2234
break ;
2247
2235
}
0 commit comments