https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80265

--- Comment #13 from Marc Glisse <glisse at gcc dot gnu.org> ---
If we need the "if constexpr()" that is proposed for C++20, we might as well
implement that (and enable it in system headers for C++17 if that's useful), it
seems better than abusing __builtin_constant_p, which is getting contradictory
requirements from its various uses:
- constexpr (forces very early lowering)
- warning/error (forbid splitting or anything that might create calls with
constants that did not exist in the user's code, or lower to false before such
transformation)
- optimization (wants to delay lowering to false quite late (though not so late
that the code without __bcp isn't properly optimized) and likes isolating a
path that makes the argument constant)
etc

(though at first glance your latest version seems likely to work well enough)

Reply via email to