[libcxx-commits] [PATCH] D138596: [libc++] Keep char_traits<T> for arbitrary T around until LLVM 18
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 25 09:13:37 PST 2022
Mordante added inline comments.
================
Comment at: libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp:84
assert_is_formattable<CharT[42], CharT>();
- assert_is_formattable<std::basic_string<CharT>, CharT>();
- assert_is_formattable<std::basic_string_view<CharT>, CharT>();
+ if constexpr (!std::same_as<CharT, int>) { // string and string_view only work with proper character types
+ assert_is_formattable<std::basic_string<CharT>, CharT>();
----------------
ldionne wrote:
> @Mordante Did you really mean to test `std::format` with a character type of `int`? Is that meaningful?
Yes that is intended. When you look at `assert_is_formattable` the only formattable `CharT`'s are `char` and `wchar_t`. So `char8_t`, `char16_t`, `char32_t` and non character types like `int` are never formattable.
I agree with the change; I didn't noticed before since the `basic_string` and `basic_string_view` "worked" with `int`s. Thanks for the fix.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138596/new/
https://reviews.llvm.org/D138596
More information about the libcxx-commits
mailing list