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

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 23 08:03:15 PDT 2021

curdeius marked an inline comment as done.
curdeius added inline comments.

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}} {{.+}}}}}}
Quuxplusone wrote:
> 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.)
Indeed, will change when landing (hopefully not breaking anything).

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), "");
Quuxplusone wrote:
> 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
Yeah, I laughed the moment I saw this :).

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list