https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86050
--- Comment #4 from Konstantin Kharlamov <Hi-Angel at yandex dot ru> --- Works for me on gcc 9.1.0. I compile it as: $ g++ test.cpp -o a -O2 And then running `./a` results in a bunch of: Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes Consumed 80 bytes