[llvm-bugs] [Bug 50402] New: std::string_view::find in constexpr function is not constant expression

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 19 03:50:03 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50402

            Bug ID: 50402
           Summary: std::string_view::find in constexpr function is not
                    constant expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2b
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hewillk at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following code fails in trunk:

https://godbolt.org/z/zKjnMsqP9

#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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210519/acca9b2c/attachment.html>


More information about the llvm-bugs mailing list