[libcxx-commits] [PATCH] D99184: [libc++] [C++20] [P0482] Add missing tests and synopses for char8_t.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 23 07:38:40 PDT 2021


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

LGTM FWIW.



================
Comment at: libcxx/test/std/strings/basic.string.hash/char_type_hash.fail.cpp:63
+    // expected-error-re at -4 4 {{{{call to implicitly-deleted default constructor of 'std::hash<str_t>'|implicit instantiation of undefined template}} {{.+}}}}}}
+#endif
     (void)h;
----------------
It might arguably be clearer to say
```
std::hash<str_t>
        h; // expected-error-re 4 {{{{call to implicitly-deleted default constructor of 'std::hash<str_t>'|implicit instantiation of undefined template}} {{.+}}}}}}
#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
    // expected-error at -2 {{call to implicitly-deleted default constructor}}
#endif
```
but I have no strong feelings. (I just now learned that `expected-error at -2 5 ...` is valid syntax.)


================
Comment at: libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp:32
     static_assert((std::is_same<std::char_traits<char8_t>::off_type,   std::streamoff>::value), "");
-    static_assert((std::is_same<std::char_traits<char8_t>::pos_type,   std::u16streampos>::value), "");
+    static_assert((std::is_same<std::char_traits<char8_t>::pos_type,   std::u8streampos>::value), "");
     static_assert((std::is_same<std::char_traits<char8_t>::state_type, std::mbstate_t>::value), "");
----------------
Cute that `u8streampos` and `u16streampos` are both just typedefs for `std::fpos<std::mbstate_t>`, so we can mix them up and C++ doesn't care. ;P


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99184/new/

https://reviews.llvm.org/D99184



More information about the libcxx-commits mailing list