// { dg-do compile { target c++23 } } #include struct S { }; template<> struct std::formatter : std::formatter { template auto format(S, std::basic_format_context& ctx) const { return formatter::format("ess", ctx); } }; struct T { }; template<> struct std::formatter : std::formatter { // This function only accepts std::format_context, not other contexts. auto format(T, std::format_context& ctx) const { return formatter::format("tee", ctx); } }; struct U { }; void test_concept() // [format.formattable] { static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( ! std::formattable ); static_assert( ! std::formattable ); static_assert( ! std::formattable ); static_assert( std::formattable ); static_assert( std::formattable ); static_assert( ! std::formattable ); // only formats as char static_assert( ! std::formattable ); // formatter not generic static_assert( ! std::formattable ); // no formatter }