2020-11-26 16:14:58 +00:00
|
|
|
contract C {
|
|
|
|
struct S {
|
|
|
|
uint x;
|
|
|
|
bool b;
|
|
|
|
}
|
|
|
|
|
|
|
|
S public s;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
s.x = 1;
|
|
|
|
s.b = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function f() public {
|
|
|
|
uint x;
|
|
|
|
bool b;
|
|
|
|
(x,b) = this.s();
|
|
|
|
assert(x == s.x); // this should hold
|
|
|
|
assert(b == s.b); // this should hold
|
|
|
|
assert(b == true); // this should fail
|
|
|
|
s.x = 42;
|
|
|
|
(uint y, bool c) = this.s();
|
|
|
|
assert(c == b); // this should hold
|
|
|
|
assert(y == x); // this should fail
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2021-03-31 15:11:54 +00:00
|
|
|
// ====
|
|
|
|
// SMTEngine: all
|
2020-11-26 16:14:58 +00:00
|
|
|
// ----
|
2021-03-31 15:11:54 +00:00
|
|
|
// Warning 6328: (255-272): CHC: Assertion violation happens here.\nCounterexample:\ns = {x: 1, b: false}\nx = 1\nb = false\ny = 0\nc = false\n\nTransaction trace:\nC.constructor()\nState: s = {x: 1, b: false}\nC.f()
|
|
|
|
// Warning 6328: (377-391): CHC: Assertion violation happens here.\nCounterexample:\ns = {x: 42, b: false}\nx = 1\nb = false\ny = 42\nc = false\n\nTransaction trace:\nC.constructor()\nState: s = {x: 1, b: false}\nC.f()
|