Opened 11 years ago

Closed 11 years ago

#433 closed bug (fixed)

Erroreous `newtruct` member assignment not caught

Reported by: dreyer Owned by: somebody
Priority: minor Milestone: 3-1-5 and higher
Component: dontKnow Version: 3-1-4
Keywords: Cc:


A user can assign elments of the wrong type to newstruct member. Singular complains, but does the assignment anyway yielding inconsistent structures:

> newstruct("wrapping","int i");
. wrapping wrap;
> intvec v=(1,2,3);
. wrap.i = v;
   ? type change in member i (int(439) -> intvec(443))
   ? error occurred in or before STDIN line 6: `wrap.i = v;`
. wrap;
> wrap.i;
> typeof(wrap.i);  // !!! -> intvec

If the assignment could not be avoided internally, the newstruct should be reseted afterwards.

I tested this with the release 3-1-4 and the recent development version.

Change History (2)

comment:1 Changed 11 years ago by dreyer

Summary: Erroreous `newtruct` member assignment notErroreous `newtruct` member assignment not caught

comment:2 Changed 11 years ago by hannes

Resolution: fixed
Status: newclosed


Note: See TracTickets for help on using tickets.