apolukhin / apolukhin.github.io

Small Blog, mostly to keep notes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

__builtin_memchr in constexpr function

AntonBikineev opened this issue · comments

Hey Anton,
__builtin_memchr returns a pointer to void and then you explicitly cast it to const char*.
This seems to be not allowed in constexpr functions and clang rejects it, whereas gcc passes.
Is there another maybe-builtin-solution for such a case?

This won't fix.

The example was designed to be a proof of concept, that it is possible to implement the constexpr char_traits. It was not intended to be a ready to use solution.