File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -256,13 +256,7 @@ void ansi_c_convert_typet::read_rec(const typet &type)
256256
257257 for (const exprt &target : to_unary_expr (as_expr).op ().operands ())
258258 {
259- if (!is_lvalue (target))
260- {
261- error ().source_location = target.source_location ();
262- error () << " illegal target in assigns clause" << eom;
263- throw 0 ;
264- }
265- else if (has_subexpr (target, ID_side_effect))
259+ if (has_subexpr (target, ID_side_effect))
266260 {
267261 error ().source_location = target.source_location ();
268262 error () << " Assigns clause is not side-effect free." << eom;
Original file line number Diff line number Diff line change @@ -739,7 +739,21 @@ void c_typecheck_baset::typecheck_declaration(
739739 }
740740
741741 for (auto &target : code_type.assigns ())
742+ {
742743 typecheck_expr (target);
744+ if (target.type ().id () == ID_empty)
745+ {
746+ error ().source_location = target.source_location ();
747+ error () << " void-typed targets not permitted" << eom;
748+ throw 0 ;
749+ }
750+ if (!target.get_bool (ID_C_lvalue))
751+ {
752+ error ().source_location = target.source_location ();
753+ error () << " illegal target in assigns clause" << eom;
754+ throw 0 ;
755+ }
756+ }
743757
744758 if (!as_const (code_type).ensures ().empty ())
745759 {
You can’t perform that action at this time.
0 commit comments