class test {
public:
test() = default;
~test() = default;
void recreate() {
this->~test();
new (this) test{};
}
};
void main() {
test b;
b.recreate();
}
Leaving aside your questions like "why do you need this", my question - is this valid and acceptable C++ code? No hidden UB here?
It compiles in MSVC 2017.