Che compilatore (clang/gcc) stai usando, e in particolare che versione?
Amaro C++, il gusto pieno dell'undefined behavior.
Regole del Forum