| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
// PR libstdc++/112607 |
| 4 |
// _Normalize does not consider char_type for the basic_string_view case |
| 5 |
|
| 6 |
#include <format> |
| 7 |
|
| 8 |
template<typename T> |
| 9 |
struct Alloc |
| 10 |
{ |
| 11 |
using value_type = T; |
| 12 |
Alloc() = default; |
| 13 |
template<typename U> |
| 14 |
Alloc(const Alloc<U>&) { } |
| 15 |
T* allocate(std::size_t); |
| 16 |
void deallocate(T*, std::size_t); |
| 17 |
bool operator==(const Alloc&) const; |
| 18 |
}; |
| 19 |
|
| 20 |
template<typename C> |
| 21 |
using String = std::basic_string<C, std::char_traits<C>, Alloc<C>>; |
| 22 |
|
| 23 |
template<> |
| 24 |
struct std::formatter<String<wchar_t>> : std::formatter<std::string> { |
| 25 |
auto format(const String<wchar_t>&, auto& ctx) const { |
| 26 |
return std::formatter<std::string>::format(" ", ctx); |
| 27 |
} |
| 28 |
}; |
| 29 |
|
| 30 |
std::string str = std::format("{}", String<wchar_t>{}); |