Skip to content

Commit 8e6ed7d

Browse files
author
Daniel Kroening
committed
retain union/struct tag type during initialization
1 parent 424569f commit 8e6ed7d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/util/expr_initializer.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,23 @@ exprt expr_initializert<nondet>::expr_initializer_rec(
291291
}
292292
else if(type_id==ID_struct_tag)
293293
{
294-
return
295-
expr_initializer_rec(
296-
ns.follow_tag(to_struct_tag_type(type)),
297-
source_location);
294+
exprt result = expr_initializer_rec(
295+
ns.follow_tag(to_struct_tag_type(type)), source_location);
296+
297+
// use the tag type
298+
result.type() = type;
299+
300+
return result;
298301
}
299302
else if(type_id==ID_union_tag)
300303
{
301-
return
302-
expr_initializer_rec(
303-
ns.follow_tag(to_union_tag_type(type)),
304-
source_location);
304+
exprt result = expr_initializer_rec(
305+
ns.follow_tag(to_union_tag_type(type)), source_location);
306+
307+
// use the tag type
308+
result.type() = type;
309+
310+
return result;
305311
}
306312
else if(type_id==ID_string)
307313
{

0 commit comments

Comments
 (0)