On main (e4751cc), this fails to compile with GCC 15.2 and -std=c++20. It compiles and runs correctly with fmt 12.2.0.
Compiler Explorer: https://godbolt.org/z/hxMdoozx8
#include <array>
#include <fmt/compile.h>
#include <fmt/ranges.h>
int main() {
std::array<int, 3> values{1, 2, 3};
auto s = fmt::format(FMT_COMPILE("array={}"), values);
fmt::print("{}\n", s);
}
Expected output:
array=[1, 2, 3]
It works without FMT_COMPILE.
This issue seems to have been introduced in 61e3b92.
A branch in nested_format_specs::write attempts to construct an iterator-specific FormatContext from a basic_appender<char>, which cannot be converted to a std::back_insert_iterator<std::string> as required by the generic_context<std::back_insert_iterator<std::string>, char> constructor. This example never actually tries to construct the FormatContext (as the branch is for padding, and we don't specify a width), but it still needs to be instantiated.
On
main(e4751cc), this fails to compile with GCC 15.2 and-std=c++20. It compiles and runs correctly with fmt 12.2.0.Compiler Explorer: https://godbolt.org/z/hxMdoozx8
Expected output:
array=[1, 2, 3]It works without
FMT_COMPILE.This issue seems to have been introduced in 61e3b92.
A branch in
nested_format_specs::writeattempts to construct an iterator-specificFormatContextfrom abasic_appender<char>, which cannot be converted to astd::back_insert_iterator<std::string>as required by thegeneric_context<std::back_insert_iterator<std::string>, char>constructor. This example never actually tries to construct theFormatContext(as the branch is for padding, and we don't specify a width), but it still needs to be instantiated.