title: When is std::string_view::operator== really constexpr?
body: <p>According to <a href="http://en.cppreference.com/w/cpp/string/basic_string_view/operator_cmp" rel="noreferrer">cppreference</a>, <code>std::string_view::operator==</code> is constexpr. I have trouble finding a situation for this to be true with current library implementations.</p>
  
  <p>Here's what I tried:</p>
  
  <pre><code>#include &lt;string_view&gt;
  
  constexpr char x0[] = "alpha";
  constexpr char y0[] = "alpha";
  constexpr auto x = std::string_view(x0, 5);
  constexpr auto y = std::string_view(y0, 5);
  
  constexpr auto a = std::string_view("alpha", 5);
  constexpr auto b = std::string_view("alpha", 5);
  
  int main()
  {
    // a, b, x, y are all constexpr, operator== is constexpr
    // therefore I expected this to compile:
    static_assert(x == y);
    static_assert(a == b);
  }
  </code></pre>
  
  <p>With gcc-trunk, this does not compile because in libstdc++ the operator== is not constexpr at all.</p>
  
  <p>With clang-trunk this also fails because operator==() is declared constexpr, but uses char_traits::compare() which is not constexpr.</p>
  
  <p>Are these bugs in the standard libraries? Or are my expectations wrong? </p>
  
  <p>If my expectations are wrong, then how can I construct a string_view that can be constexpr-compared?</p>