Skip to content

Commit f9f0931

Browse files
committed
Fix unused-local-typedef warning
1 parent 0309050 commit f9f0931

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

include/frequency/frequency.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ target_link_libraries(frequency_tests PRIVATE
1616
Catch2::Catch2WithMain
1717
)
1818

19+
target_compile_options(frequency_tests PRIVATE -Wall)
20+
1921
include(CTest)
2022
include(Catch)
2123
catch_discover_tests(frequency_tests)

0 commit comments

Comments
 (0)