diff --git a/src/core/include/units/quantity_spec.h b/src/core/include/units/quantity_spec.h index 626f7c3d..bc08cdd7 100644 --- a/src/core/include/units/quantity_spec.h +++ b/src/core/include/units/quantity_spec.h @@ -233,7 +233,7 @@ struct derived_quantity_spec : detail::expr_fractions, Q #ifdef __cpp_explicit_this_parameter template - [[nodiscard]] consteval auto operator[](this const Self, U u) + [[nodiscard]] consteval Reference auto operator[](this const Self, U u) requires(dimension == detail::get_dimension_for(u)) { return reference{}; @@ -241,7 +241,7 @@ struct derived_quantity_spec : detail::expr_fractions, Q #else // TODO can we somehow return an explicit reference type here? template - [[nodiscard]] consteval auto operator[](U u) const + [[nodiscard]] consteval Reference auto operator[](U u) const requires(dimension == detail::get_dimension_for(u)) { return reference{}; @@ -318,12 +318,12 @@ struct quantity_spec { #ifdef __cpp_explicit_this_parameter template - [[nodiscard]] consteval auto operator[](this const Self, U u) + [[nodiscard]] consteval Reference auto operator[](this const Self, U u) requires(dimension == detail::get_dimension_for(u)) #else template // TODO can we somehow return an explicit reference type here? - [[nodiscard]] consteval auto operator[](U u) const + [[nodiscard]] consteval Reference auto operator[](U u) const requires(dimension == detail::get_dimension_for(u)) #endif { @@ -386,7 +386,7 @@ struct quantity_spec : std::remove_const_t { #ifndef __cpp_explicit_this_parameter template // TODO can we somehow return an explicit reference type here? - [[nodiscard]] consteval auto operator[](U u) const + [[nodiscard]] consteval Reference auto operator[](U u) const requires(this->dimension == detail::get_dimension_for(u)) { return reference{};