https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91158
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Cassio Neri from comment #0) > However, branching at runtime is unacceptable and, if the compiler does not > know the value of n it's preferable to drop the 'if-else' altogether and > live with the less efficient code. Willing to avoid branching at runtime is > a big hint for using 'if constexpr' but, as things stand, this implies > *never* using the more efficient code. There is no runtime branch in f0. Either the value is known when compiling, and code is generated for the true branch only, or it's not known when compiling, and code is generated for the false branch only. It's not the same as if-constexpr, but it does what you want here. I don't think this is a bug. Expecting them to work the same is wrong.