Annex F (informative) Core undefined behavior [ub]

F.2 [basic]: Basics [ub.basic]

F.2.21[ub:basic.start.main.exit.during.destruction]
Specified in: [basic.start.main]

If std​::​exit is called to end a program during the destruction of an object with static or thread storage duration, the program has undefined behavior.
[Example 1: #include <cstdlib> struct Exiter { ~Exiter() { std::exit(0); } }; Exiter ex; int main() {} // undefined behavior when destructor of static variable ex is called it will call std​::​exit — end example]