Compare commits

...

5 Commits

Author SHA1 Message Date
Eduardo Gómez
89bb4b5dd1
Merge 8793ca53e5dbcade50fbf281fe5ad99833cbaa95 into caf5e48b1c56c3dee14768ed7ce08a9d51d03b58 2026-07-28 11:32:36 +00:00
Victor Zverovich
caf5e48b1c Update changelog 2026-07-26 13:12:27 -07:00
Victor Zverovich
2a2d9edb25 Remove extra newline 2026-07-25 07:52:08 -07:00
Victor Zverovich
90567e92d4 Exercise compiled field path in FMT_COMPILE format_as test
The FMT_COMPILE("{}") format string takes a to_string fast path that
never runs the compiled field code the format_as fix (#4836) touched.
Use "[{}]" so the test actually goes through detail::field::format.
2026-07-23 13:35:44 -07:00
Victor Zverovich
c851fbe658 Apply clang-format 2026-07-23 13:10:37 -07:00
4 changed files with 76 additions and 10 deletions

View File

@ -1,3 +1,70 @@
# 12.2.1 - TBD
- Added a formatter for `std::exception_ptr` that formats the referenced
exception (or `none` when null)
(https://github.com/fmtlib/fmt/issues/4808,
https://github.com/fmtlib/fmt/pull/4819).
Thanks @avikivity and @Atlas-Zero.
- Added unwinding of nested exceptions created via
`std::throw_with_nested` to the `std::exception` formatter, joining each
level with `": "` (https://github.com/fmtlib/fmt/pull/4844).
Thanks @avikivity.
- Exported the ostream formatters (`fmt::basic_ostream_formatter`,
`fmt::ostream_formatter`) and `fmt::streamed` from the C++20 module
(https://github.com/fmtlib/fmt/pull/4861). Thanks @avikivity.
- Optimized 128-bit integer formatting by reducing the value to 64-bit
chunks instead of doing repeated 128-bit division, giving a ~5x speedup
on full-range values.
- Fixed handling of out-of-range floating-point durations in chrono
formatting (https://github.com/fmtlib/fmt/pull/4802). Thanks @aizu-m.
- Fixed a hang and assertion failure when printing to a pipe whose read
end is closed (https://github.com/fmtlib/fmt/issues/4797).
Thanks @nikola-sh.
- Fixed formatting of out-of-range integers with the `c` presentation
type, which previously mangled negative values and silently truncated
out-of-range ones (https://github.com/fmtlib/fmt/issues/4839).
Thanks @igoloe.
- Fixed an `FMT_COMPILE` failure for user-defined types formatted via
`format_as` (https://github.com/fmtlib/fmt/issues/4794,
https://github.com/fmtlib/fmt/pull/4836).
Thanks @mjerabek and @upadhyay74aman.
- Fixed the fallback `uint128` bitwise-not implementation
(https://github.com/fmtlib/fmt/pull/4813). Thanks @Vcode2407.
- Fixed a false positive in `fmt::is_contiguous` by explicitly checking
for `operator[]` on the container itself
(https://github.com/fmtlib/fmt/pull/4825). Thanks @tearfur.
- Generated the build-tree CMake export set regardless of `FMT_INSTALL`,
so projects consuming {fmt} via `add_subdirectory` or `FetchContent` can
export their own `fmt::*`-dependent targets
(https://github.com/fmtlib/fmt/issues/4806,
https://github.com/fmtlib/fmt/pull/4850). Thanks @Krzmbrzl and @hexonal.
- Made the `fmt-c` library respect `BUILD_SHARED_LIBS` like the main
{fmt} library (https://github.com/fmtlib/fmt/pull/4812). Thanks @jengelh.
- Skipped `VERSION`/`SOVERSION`/`DEBUG_POSTFIX` on the header-only
`INTERFACE` target (https://github.com/fmtlib/fmt/pull/4830).
Thanks @soumik15630m.
- Suppressed the MSVC C4702 (unreachable code) warning
(https://github.com/fmtlib/fmt/pull/4822). Thanks @torsten48.
- Documented that the hexfloat `a`/`A` presentation types always emit the
`0x` prefix (https://github.com/fmtlib/fmt/pull/4862). Thanks @ny000815.
- Fixed a minor formatting issue in the documentation
(https://github.com/fmtlib/fmt/pull/4826). Thanks @brooklynwidz.
# 12.2.0 - 2026-06-16
- Added a C11 API that brings fast, type-safe formatting to C. The new

View File

@ -165,7 +165,6 @@ void println(std::ostream& os, format_string<T...> fmt, T&&... args) {
}
FMT_END_EXPORT
FMT_END_NAMESPACE
#endif // FMT_OSTREAM_H_

View File

@ -19,6 +19,5 @@ endif ()
# Test that a target depending on fmt can itself be exported (#4806).
add_library(export-test INTERFACE)
target_link_libraries(export-test INTERFACE fmt::fmt)
export(
TARGETS export-test
FILE ${CMAKE_CURRENT_BINARY_DIR}/export-test-targets.cmake)
export(TARGETS export-test
FILE ${CMAKE_CURRENT_BINARY_DIR}/export-test-targets.cmake)

View File

@ -480,12 +480,13 @@ TEST(compile_test, constexpr_string_format) {
}
#endif // FMT_USE_CONSTEXPR_STRING
namespace {
struct compile_format_as_type {
struct type_with_format_as {
int value;
};
int format_as(compile_format_as_type f) { return f.value; }
}
int format_as(type_with_format_as v) { return v.value; }
TEST(compile_test, format_as) {
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), compile_format_as_type{42}));
}
// Use a format string other than "{}" so that formatting goes through the
// compiled field path rather than the to_string fast path.
EXPECT_EQ("[42]", fmt::format(FMT_COMPILE("[{}]"), type_with_format_as{42}));
}