https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112296
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- __builtin_constant_p is limited by inlining, maybe you want to use if constexpr for this or the standard library facility I can't remember right now.