Bug in class implementation
Here is a definition of the class which is a counter, where the update effect is merged into the value
accessor:
class cnt;
classtype int;
export all;
cnt new (int x) {
return to_cnt (x);
}
int value (cnt &x) {
v = from_cnt (x);
x = to_cnt (_add_SxS_ (v, 1));
return v;
}
Here is the file that uses this class:
use cnt:all;
int main () {
a = new (1);
return value (a);
}
When I run this, I get the value 2 back, but the correct result is 1.
The version of sac2c I used is: sac2c 1.3.3-MijasCosta-1161-gb543c