libstdc++-v3/testsuite/std/format/format_string.cc
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #include <format> |
| 4 | |
| 5 | struct Str |
| 6 | { |
| 7 | consteval operator std::string_view() const { return ""; } |
| 8 | operator std::string_view() = delete; |
| 9 | }; |
| 10 | |
| 11 | // PR libstdc++/108024 |
| 12 | static_assert( std::is_constructible_v<std::format_string<>, const Str&> ); |
| 13 | static_assert( std::is_convertible_v<const Str&, std::format_string<>> ); |
| 14 | |
| 15 | constinit std::format_string<> s = Str(); |