libstdc++: Check string value_type in std::make_format_args [PR112607]
[official-gcc.git] / libstdc++-v3 / testsuite / std / format / arguments / 112607.cc
blob19eec765ea58aea99d493ccfd4f68cdbe8aff825
1 // { dg-do compile { target c++20 } }
3 // PR libstdc++/112607
4 // _Normalize does not consider char_type for the basic_string_view case
6 #include <format>
8 template<typename T>
9 struct Alloc
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;
20 template<typename C>
21 using String = std::basic_string<C, std::char_traits<C>, Alloc<C>>;
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);
30 std::string str = std::format("{}", String<wchar_t>{});