diff --git a/src/core/include/mp-units/framework/reference.h b/src/core/include/mp-units/framework/reference.h index d74c5cc8..5c050858 100644 --- a/src/core/include/mp-units/framework/reference.h +++ b/src/core/include/mp-units/framework/reference.h @@ -193,9 +193,9 @@ struct reference { template Rep = std::remove_cvref_t> requires(!detail::OffsetUnit) -[[nodiscard]] constexpr quantity operator*(FwdRep&& lhs, R) +[[nodiscard]] constexpr quantity operator*(FwdRep&& lhs, R r) { - return quantity{std::forward(lhs), R{}}; + return quantity{std::forward(lhs), r}; } template Rep = std::remove_cvref_t> requires detail::OffsetUnit -[[noreturn]] constexpr auto operator*(FwdRep&&, R) +[[deprecated( + "References using offset units (e.g., temperatures) should be constructed with the `delta` or `absolute` " + "helpers")]] constexpr auto +operator*(FwdRep&& lhs, R r) { - static_assert(!detail::OffsetUnit, - "References using offset units (e.g., temperatures) may be constructed only with the `delta` or " - "`absolute` helpers"); + return quantity{std::forward(lhs), r}; } template Rep = std::remove_cvref_t> requires detail::OffsetUnit -[[noreturn]] constexpr auto operator/(FwdRep&&, R) +[[deprecated( + "References using offset units (e.g., temperatures) should be constructed with the `delta` or `absolute` " + "helpers")]] constexpr auto +operator/(FwdRep&& lhs, R) { - static_assert(!detail::OffsetUnit, - "References using offset units (e.g., temperatures) may be constructed only with the `delta` or " - "`absolute` helpers"); + return quantity{std::forward(lhs), inverse(R{})}; } template