@@ -445,9 +445,8 @@ class frequency {
445445
446446 // Integer-only path when both types are integral
447447 if constexpr (std::is_integral_v<rep> && std::is_integral_v<duration_rep>) {
448- using cr = std::common_type_t <duration_rep, rep, intmax_t >;
449-
450448#ifdef __SIZEOF_INT128__
449+ using cr = std::common_type_t <duration_rep, rep, intmax_t >;
451450 using wider_t = std::conditional_t <std::is_signed_v<cr>, __int128, unsigned __int128>;
452451#else
453452 using wider_t = intmax_t ;
@@ -746,11 +745,11 @@ constexpr ToFreq frequency_cast(const frequency<Rep, Precision>& f) {
746745 using to_rep = typename ToFreq::rep;
747746 using to_precision = typename ToFreq::precision;
748747 using cf = std::ratio_divide<Precision, to_precision>;
749- using cr = std::common_type_t <to_rep, Rep, intmax_t >;
750748
751749 // Use wider intermediate type for integer-to-integer conversions
752750 if constexpr (std::is_integral_v<Rep> && std::is_integral_v<to_rep>) {
753751#ifdef __SIZEOF_INT128__
752+ using cr = std::common_type_t <to_rep, Rep, intmax_t >;
754753 using wider_t = std::conditional_t <std::is_signed_v<cr>, __int128, unsigned __int128>;
755754#else
756755 using wider_t = intmax_t ;
@@ -776,7 +775,8 @@ constexpr ToFreq frequency_cast(const frequency<Rep, Precision>& f) {
776775 return ToFreq (static_cast <to_rep>(result));
777776 }
778777 } else {
779- // Floating-point path (existing behavior)
778+ // Floating-point path
779+ using cr = std::common_type_t <to_rep, Rep, intmax_t >;
780780 if constexpr (cf::den == 1 && cf::num == 1 ) {
781781 return ToFreq (static_cast <to_rep>(f.count ()));
782782 } else if constexpr (cf::den == 1 ) {
0 commit comments