#include<bits/stdc++.h>
using namespace std;
struct f{
int x;
f():x(0){}
f& operator+=(int b){
x += b;
return *this;
}
};
f t(){
return f();
}
int main(){
f* x = &(t() += 2);
x->x += 2;
cout << x->x << ' ' << &x;
}
这是不是一个悬挂指针?但好像可以正常运行。
我要睡觉了,明天才会看这个贴子的回复。