From faf4541dd89bdcf4727589419aaf07972a506711 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 11 Oct 2020 15:23:17 +0200 Subject: [PATCH] Added extra macro to determine whether compiler has ref qualifiers --- include/fmt/format.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 1fc57de1..baebcff0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -272,6 +272,12 @@ FMT_END_NAMESPACE # define FMT_DEPRECATED_NUMERIC_ALIGN 0 #endif +#ifdef __cpp_ref_qualifiers + # define FMT_METHOD_REF_QUALIFIER & +#else + # define FMT_METHOD_REF_QUALIFIER +#endif + FMT_BEGIN_NAMESPACE namespace detail { @@ -828,7 +834,7 @@ struct FMT_EXTERN_TEMPLATE_API uint128_wrapper { uint64_t high() const FMT_NOEXCEPT { return uint64_t(internal_ >> 64); } uint64_t low() const FMT_NOEXCEPT { return uint64_t(internal_); } - uint128_wrapper& operator+=(uint64_t n) & FMT_NOEXCEPT { + uint128_wrapper& operator+=(uint64_t n) FMT_METHOD_REF_QUALIFIER FMT_NOEXCEPT { internal_ += n; return *this; } @@ -842,7 +848,7 @@ struct FMT_EXTERN_TEMPLATE_API uint128_wrapper { uint64_t high() const FMT_NOEXCEPT { return high_; } uint64_t low() const FMT_NOEXCEPT { return low_; } - uint128_wrapper& operator+=(uint64_t n) & FMT_NOEXCEPT { + uint128_wrapper& operator+=(uint64_t n) FMT_METHOD_REF_QUALIFIER FMT_NOEXCEPT { # if defined(_MSC_VER) && defined(_M_X64) unsigned char carry = _addcarry_u64(0, low_, n, &low_); _addcarry_u64(carry, high_, 0, &high_);