下面的代码错了吗?我正在返回对局部变量的引用......它应该是核心转储,但它执行得很好。下面的代码在我的系统上工作正常吗,因为我很幸运?
#include<iostream>
using namespace std;
class a{
    public:
    int i;
    int arr[20];
    a()
    {
        cout<<"\ninside constructor";
        i=10;
    }
    public:
    static a& ret()
    {
        a chk;
        return chk;
    }
    void say()
    {
        i=10;
        arr[0]=1;
        cout<<"\nHello World\n";
    }
};
int main()
{
(a::ret()).say();
return 1;
}