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

            Bug ID: 100675
           Summary: std::string_view::find in constexpr function is not
                    constant expression
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code fails in 10.1, 10.2, and 10.3:

https://godbolt.org/z/soGT9o4GY

#include <string_view>

template <class>
constexpr bool g() {
  std::string_view s = " ";
  s.find(" ");
  return true;
}

constexpr bool b = g<void>();          // ok
template <class T> concept C = g<T>();
static_assert(C<void>);                // error

Reply via email to