It should be sufficient to move only following to formatfwd.h to declare disabled specialization for optional. I do not think that we need to move to a partial specialization of format_kind for ranges. // [format.range], formatting of ranges + // [format.range.fmtkind], variable template format_kind + enum class range_format { + disabled, + map, + set, + sequence, + string, + debug_string + }; + + /** @brief A constant determining how a range should be formatted. + * + * The primary template of `std::format_kind` cannot be instantiated. + * There is a partial specialization for input ranges and you can + * specialize the variable template for your own cv-unqualified types + * that satisfy the `ranges::input_range` concept. + * + * @since C++23 + */ + template<typename _Rg> + constexpr auto format_kind = []{ + static_assert(false, "cannot use primary template of 'std::format_kind'"); + return type_identity<_Rg>{}; + }();
You are not testing for the __cpp_lib_optional_range_support macro in the test file. And I would add a static_assert(!formattable<optional<int>>) to the tests. On Tue, Jun 10, 2025 at 5:21 PM Giuseppe D'Angelo <giuseppe.dang...@kdab.com> wrote: > Hello, > > On 10/06/2025 16:32, Jonathan Wakely wrote: > >> Whops, I again addedstd::string to a constexpr test, so this will fail > >> on the old ABI. Should I change it to e.g.std::vector, or should I keep > >> it and add a `{ dg-require-effective-target cxx11_abi }` directive? > > > > Would string_view work instead? If not, please change it to vector. > > Added both and removed string. New patch attached. > > Thank you, > > -- > Giuseppe D'Angelo >