[Bug c++/80265] __builtin_{memcmp,memchr,strlen} are not usable in constexpr functions

palves at redhat dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 23 11:49:00 GMT 2018


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

--- Comment #23 from Pedro Alves <palves at redhat dot com> ---
I think support in the compiler directly is likely to have better compile-time
performance, and I've stated from the beginning that I'd prefer that, FWIW.

OTOH, meanwhile, AFAICT, there's nothing preventing factoring out the trick
bits from char_traits into libstdc++-internal
__constexpr_strlen/__constexpr_memcmp etc. functions, that fallback into the
__builtin_xxx functions when arguments are not constexpr (just like the
char_traits versions), and using those throughout instead in constexpr
functions.


More information about the Gcc-bugs mailing list