summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dd7ef12)
gcc 13.1 erroneously warns of dangling references when using our custom
formatters. This was reported to both fmtlib and gcc and fixes have been
provided, but are not released yet.
This change backports two fixes from the master branch to our vendored
version:
https://github.com/fmtlib/fmt/commit/
f61f15cc5b11582d50d02ba0514c5344f7b2600e
https://github.com/fmtlib/fmt/commit/
ef55d4f52ec527668a8e910a56ea79d9b939dbc2
For more information on the issue, see:
https://github.com/fmtlib/fmt/issues/3415
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=
6b927b1297e66e26e62e722bf15c921dcbbd25b9
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I30bbbbe5e0aa2729e50228acdb528ee060d9df23
template <typename Context, typename T>
FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value<Context> {
template <typename Context, typename T>
FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value<Context> {
- const auto& arg = arg_mapper<Context>().map(FMT_FORWARD(val));
+ using arg_type = remove_cvref_t<decltype(arg_mapper<Context>().map(val))>;
constexpr bool formattable_char =
constexpr bool formattable_char =
- !std::is_same<decltype(arg), const unformattable_char&>::value;
+ !std::is_same<arg_type, unformattable_char>::value;
static_assert(formattable_char, "Mixing character types is disallowed.");
static_assert(formattable_char, "Mixing character types is disallowed.");
- constexpr bool formattable_const =
- !std::is_same<decltype(arg), const unformattable_const&>::value;
- static_assert(formattable_const, "Cannot format a const argument.");
-
// Formatting of arbitrary pointers is disallowed. If you want to output
// a pointer cast it to "void *" or "const void *". In particular, this
// forbids formatting of "[const] volatile char *" which is printed as bool
// by iostreams.
constexpr bool formattable_pointer =
// Formatting of arbitrary pointers is disallowed. If you want to output
// a pointer cast it to "void *" or "const void *". In particular, this
// forbids formatting of "[const] volatile char *" which is printed as bool
// by iostreams.
constexpr bool formattable_pointer =
- !std::is_same<decltype(arg), const unformattable_pointer&>::value;
+ !std::is_same<arg_type, unformattable_pointer>::value;
static_assert(formattable_pointer,
"Formatting of non-void pointers is disallowed.");
static_assert(formattable_pointer,
"Formatting of non-void pointers is disallowed.");
- constexpr bool formattable =
- !std::is_same<decltype(arg), const unformattable&>::value;
+ constexpr bool formattable = !std::is_same<arg_type, unformattable>::value;
static_assert(
formattable,
"Cannot format an argument. To make type T formattable provide a "
"formatter<T> specialization: https://fmt.dev/latest/api.html#udt");
static_assert(
formattable,
"Cannot format an argument. To make type T formattable provide a "
"formatter<T> specialization: https://fmt.dev/latest/api.html#udt");
+ return {arg_mapper<Context>().map(val)};
}
template <typename Context, typename T>
}
template <typename Context, typename T>