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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC can't even optimize it properly for C++20 when using if-consteval:

  static constexpr unsigned long length(const char* s)
  {
#ifndef FIX
    if consteval {
      unsigned long n = 0;
      while (*s++)
        ++n;
      return n;
    }
#endif
    return __builtin_strlen(s);
  }

Reply via email to