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: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Apr 2017 11:33:49 +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 #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That doesn't work in this case:
constexpr bool str()
{
char s[] = "str";
return ce_char_traits<char>::length(s) == 3;
}
static_assert( str() );
i.e. it works OK for C++11-style constant expressions, but not C++14 ones.