This is an example to illustrate my question which involves some much more complicated code that I can\'t post here.
#include
int main()
{
If you're interested in a purely theoretical answer, the C++ standard allows undefined behaviour to "time travel":
[intro.execution]/5:A conforming implementation executing a well-formed program shall produce the same observable behavior as one of the possible executions of the corresponding instance of the abstract machine with the same program and the same input. However, if any such execution contains an undefined operation, this International Standard places no requirement on the implementation executing that program with that input (not even with regard to operations preceding the first undefined operation)
As such, if your program contains undefined behaviour, then the behaviour of your whole program is undefined.