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