The 'ValueObject::AddressOf()' method assumes that the address of a value object cannot change, so when it is calculated once, it does not need to be updated afterwards. However, this is not the case if the 'ValueObject' is a dependent object obtained by calling 'Dereference()' of another 'ValueObject'. If the latter object is changed, the dependent value object should return a new address from the 'AddressOf()' method to reflect the change. (cherry picked from commit 320164daab4148e3372f6756caaa67882e24a91f)
32 lines
397 B
C
32 lines
397 B
C
int test1() {
|
|
int a = 5;
|
|
int b = 7;
|
|
int *p = &a;
|
|
p = &b; // break here 1
|
|
return *p;
|
|
}
|
|
|
|
char test2() {
|
|
struct S {
|
|
char a;
|
|
char b;
|
|
};
|
|
struct S arr[2] = {{'a', 'b'}, {'c', 'd'}};
|
|
struct S *p = arr;
|
|
++p; // break here 2
|
|
return p->b;
|
|
}
|
|
|
|
int test3() {
|
|
int a = 5;
|
|
int b = 7;
|
|
return a + b; // break here 3
|
|
}
|
|
|
|
int main() {
|
|
test1();
|
|
test2();
|
|
test3();
|
|
return 0;
|
|
}
|