diff --git a/include/fmt/core.h b/include/fmt/core.h index f6886cf4..1f3e5801 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -13,6 +13,7 @@ #include // std::strlen #include #include +#include // std::addressof #include #include @@ -1281,9 +1282,9 @@ template class value { FMT_INLINE value(const named_arg_info* args, size_t size) : named_args{args, size} {} - template FMT_CONSTEXPR FMT_INLINE value(T& val) { + template FMT_CONSTEXPR20 FMT_INLINE value(T& val) { using value_type = remove_const_t; - custom.value = const_cast(&val); + custom.value = const_cast(std::addressof(val)); // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and // `printf_formatter` for `printf`.