'dup' is needed for assignment, so if it isn't present
it must be forbidden.
Signed-off-by: NeilBrown <neil@brown.name>
case Assign:
case Declare:
case Assign:
case Declare:
- /* Both must match and not be labels, result is Tnone */
+ /* Both must match and not be labels,
+ * Type must support 'dup',
+ * result is Tnone */
t = propagate_types(b->left, c, ok, NULL, Rnolabel);
if (!b->right)
return Tnone;
t = propagate_types(b->left, c, ok, NULL, Rnolabel);
if (!b->right)
return Tnone;
if (t)
propagate_types(b->left, c, ok, t, 0);
}
if (t)
propagate_types(b->left, c, ok, t, 0);
}
+ if (t && t->dup == NULL) {
+ type_err(c, "error: cannot assign value of type %1", b, t, 0, NULL);
+ *ok = 0;
+ }