Wednesday, 14 October 2015

There is such a thing as too much compiler optimization

After spending the last few years using antiquated subsets of C and C++, I've decided to try my hand at the latest Standards and Proposals.

After some time I found this weird... Bug? I'm willing to bet it's just compiler optimization at work.

The following are screenshots taken after compiling the code. I'm ashamed to say this took me at least 15 minutes to figure out.

This works
This doesn't (std::array is not a defined type)
This works. Wat?