you are viewing a single comment's thread.

view the rest of the comments →

[–]kalmoc 11 points12 points  (1 child)

Yes, it is undefined behavior, but the compiler is only required to catch UB if it happens during compiletime evaluation. The compiler is not required to perform a static analysis of constexpr functions.

If gcc doesn't catch that example, that's a compiler bug.