| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
#include <format> |
| 4 |
|
| 5 |
template<typename T, |
| 6 |
typename C = std::remove_cvref_t<decltype(std::declval<T&>()[0])>> |
| 7 |
constexpr bool |
| 8 |
test_pr112832() |
| 9 |
{ |
| 10 |
std::formatter<T, C> f; |
| 11 |
if constexpr (requires{ f.set_debug_format(); }) |
| 12 |
f.set_debug_format(); |
| 13 |
return true; |
| 14 |
} |
| 15 |
|
| 16 |
int main() |
| 17 |
{ |
| 18 |
static_assert(test_pr112832<std::string_view>()); |
| 19 |
static_assert(test_pr112832<char*>()); |
| 20 |
static_assert(test_pr112832<const char*>()); |
| 21 |
static_assert(test_pr112832<char[1]>()); |
| 22 |
#ifdef _GLIBCXX_USE_WCHAR_T |
| 23 |
static_assert(test_pr112832<std::wstring_view>()); |
| 24 |
static_assert(test_pr112832<wchar_t*>()); |
| 25 |
static_assert(test_pr112832<const wchar_t*>()); |
| 26 |
static_assert(test_pr112832<wchar_t[1]>()); |
| 27 |
static_assert(test_pr112832<char, wchar_t>()); |
| 28 |
#endif |
| 29 |
} |