4 ms·
This does not really "guarantee" anything. You can still have as much UB (incl leaks) as you want, as long as they are not evaluated at compile-time. i.e. it's
by AshamedCaptain 4y ago
This does not really "guarantee" anything. You can still have as much UB (incl leaks) as you want, as long as they are not evaluated at compile-time. i.e. it's at best equivalent to running valgrind.
- dgellow 4y agoWhat would be examples of runtime UBs that wouldn’t be reported when used within a constexpr?
- simiones 4y agoThe point is that the code is only checked for UB with the arguments it is given at compile time. There is no guarantee that it can't invoke UB with other arguments it might receive at runtime. For example, here is a modification of the original program that does invoke UB, but compiles just fine: https://godbolt.org/z/MaqhcEYqn https://godbolt.org/z/MaqhcEYqn
- dgellow 4y agoOh yes, I see your point. Thanks for clarifying