C++静态成员函数的生命周期解决方案

C++静态成员函数的生命周期
假如我如下定义一个类
class temp
{
public:
    static void struct(){
        temp   t1;
    }
    
    ~temp(){
        delete p;
    }
private:
    char *p;
    temp(){
        p = new char[10];
    }
}

然后这样调用它
temp::struct();

这样的用法,就是通过类的静态成员函数声明类(专业术语不记得了)
请问,指针p、什么情况下会被释放?
C++ 静态成员函数

------解决方案--------------------
static void struct(){
        temp   t1;
    }
temp::struct();

这个是函数退出马上释放了。