This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80265] __builtin_{memcmp,memchr,strlen} are not usable in constexpr functions
- From: "palves at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 23 Mar 2018 11:49:20 +0000
- Subject: [Bug c++/80265] __builtin_{memcmp,memchr,strlen} are not usable in constexpr functions
- Auto-submitted: auto-generated
- References: <bug-80265-4@http.gcc.gnu.org/bugzilla/>
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.