| > If a situation has been statically determined to invoke UB that should be a compile time error. That's simply not how the compiler works. There is (presumably, I haven't actually looked) no boolean function in GCC called is_undefined_behavior().
It's just that each optimization part of the compiler can (and does) assume that UB doesn't happen, and results like the article's are then essentially emergent behavior. See also: https://blog.regehr.org/archives/213 |
https://shafik.github.io/c++/undefined%20behavior/2019/05/11...