@@ -271,7 +271,10 @@ void c_typecheck_baset::designator_enter(
271
271
272
272
for (const auto &c : struct_type.components ())
273
273
{
274
- if (c.type ().id () != ID_code && !c.get_is_padding ())
274
+ DATA_INVARIANT (
275
+ c.type ().id () != ID_code, " struct member must not be of code type" );
276
+
277
+ if (!c.get_is_padding ())
275
278
{
276
279
entry.subtype = c.type ();
277
280
break ;
@@ -456,9 +459,12 @@ exprt::operandst::const_iterator c_typecheck_baset::do_designated_initializer(
456
459
457
460
DATA_INVARIANT (index <components.size (),
458
461
" member designator is bounded by components size" );
459
- DATA_INVARIANT (components[index ].type ().id ()!=ID_code &&
460
- !components[index ].get_is_padding (),
461
- " member designator points at data member" );
462
+ DATA_INVARIANT (
463
+ components[index ].type ().id () != ID_code,
464
+ " struct member must not be of code type" );
465
+ DATA_INVARIANT (
466
+ !components[index ].get_is_padding (),
467
+ " member designator points at non-padding member" );
462
468
463
469
dest=&(dest->operands ()[index ]);
464
470
}
@@ -736,8 +742,7 @@ void c_typecheck_baset::increment_designator(designatort &designator)
736
742
(components[entry.index ].get_is_padding () ||
737
743
(components[entry.index ].get_anonymous () &&
738
744
components[entry.index ].type ().id () != ID_struct_tag &&
739
- components[entry.index ].type ().id () != ID_union_tag) ||
740
- components[entry.index ].type ().id () == ID_code))
745
+ components[entry.index ].type ().id () != ID_union_tag)))
741
746
{
742
747
entry.index ++;
743
748
}
0 commit comments