Skip to content

Commit 61147fc

Browse files
committed
Fix old GCC warnings
1 parent 8080603 commit 61147fc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

include/boost/decimal/decimal32_fast.hpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ class decimal32_fast final
136136
explicit constexpr operator detail::uint128_t() const noexcept;
137137
#endif
138138

139+
#if !defined(BOOST_DECIMAL_DISABLE_CLIB)
140+
139141
// TODO(mborland): Remove and use the base implementation in io.hpp
140142
template <typename charT, typename traits>
141143
friend auto operator<<(std::basic_ostream<charT, traits>& os, const decimal32_fast& d) -> std::basic_ostream<charT, traits>&
@@ -156,6 +158,8 @@ class decimal32_fast final
156158
return os;
157159
}
158160

161+
#endif
162+
159163
friend constexpr auto direct_init(std::uint32_t significand, std::uint8_t exponent, bool sign) noexcept -> decimal32_fast;
160164
};
161165

@@ -175,7 +179,18 @@ constexpr decimal32_fast::decimal32_fast(T1 coeff, T2 exp, bool sign) noexcept
175179
if (reduced)
176180
{
177181
const auto digits_to_remove {static_cast<Unsigned_Integer>(unsigned_coeff_digits - (detail::precision_v<decimal32> + 1))};
178-
unsigned_coeff /= detail::pow10(digits_to_remove);
182+
183+
#if defined(__GNUC__) && !defined(__clang__)
184+
# pragma GCC diagnostic push
185+
# pragma GCC diagnostic ignored "-Wconversion"
186+
#endif
187+
188+
unsigned_coeff /= static_cast<Unsigned_Integer>(detail::pow10(digits_to_remove));
189+
190+
#if defined(__GNUC__) && !defined(__clang__)
191+
# pragma GCC diagnostic pop
192+
#endif
193+
179194
exp += static_cast<std::uint8_t>(digits_to_remove);
180195
exp += static_cast<T2>(detail::fenv_round(unsigned_coeff, isneg));
181196
}

0 commit comments

Comments
 (0)