Skip to content

Commit 37525db

Browse files
committed
Add static_cast<bool> in end.pass.cpp to avoid truncation warnings with MSVC
1 parent 6cb18ac commit 37525db

File tree

1 file changed

+14
-14
lines changed
  • libcxx/test/std/ranges/range.adaptors/range.join.with/range.join.with.view

1 file changed

+14
-14
lines changed

libcxx/test/std/ranges/range.adaptors/range.join.with/range.join.with.view/end.pass.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ concept JoinWithViewHasConstEnd = requires(const std::ranges::join_with_view<V,
3333
template <size_t Bits>
3434
requires(Bits < (1 << 7))
3535
constexpr void test_end() {
36-
constexpr bool v_models_forward_range = Bits & (1 << 0);
37-
constexpr bool inner_range_is_reference = Bits & (1 << 1);
38-
constexpr bool inner_range_models_forward_range = Bits & (1 << 2);
39-
constexpr bool v_models_common_range = Bits & (1 << 3);
40-
constexpr bool inner_range_models_common_range = Bits & (1 << 4);
41-
constexpr bool v_models_simple_range = Bits & (1 << 5);
42-
constexpr bool pattern_models_simple_range = Bits & (1 << 6);
36+
constexpr bool v_models_forward_range = static_cast<bool>(Bits & (1 << 0));
37+
constexpr bool inner_range_is_reference = static_cast<bool>(Bits & (1 << 1));
38+
constexpr bool inner_range_models_forward_range = static_cast<bool>(Bits & (1 << 2));
39+
constexpr bool v_models_common_range = static_cast<bool>(Bits & (1 << 3));
40+
constexpr bool inner_range_models_common_range = static_cast<bool>(Bits & (1 << 4));
41+
constexpr bool v_models_simple_range = static_cast<bool>(Bits & (1 << 5));
42+
constexpr bool pattern_models_simple_range = static_cast<bool>(Bits & (1 << 6));
4343

4444
constexpr ViewProperties inner_range_props{.common = inner_range_models_common_range};
4545
using InnerRange =
@@ -108,13 +108,13 @@ constexpr void test_end() {
108108
template <std::size_t Bits>
109109
requires(Bits < (1 << 7))
110110
constexpr void test_const_end() {
111-
constexpr bool const_v_models_forward_range = Bits & (1 << 0);
112-
constexpr bool const_pattern_models_forward_range = Bits & (1 << 1);
113-
constexpr bool inner_const_range_is_reference = Bits & (1 << 2);
114-
constexpr bool inner_const_range_models_input_range = Bits & (1 << 3);
115-
constexpr bool inner_const_range_models_forward_range = Bits & (1 << 4);
116-
constexpr bool const_v_models_common_range = Bits & (1 << 5);
117-
constexpr bool inner_const_range_models_common_range = Bits & (1 << 6);
111+
constexpr bool const_v_models_forward_range = static_cast<bool>(Bits & (1 << 0));
112+
constexpr bool const_pattern_models_forward_range = static_cast<bool>(Bits & (1 << 1));
113+
constexpr bool inner_const_range_is_reference = static_cast<bool>(Bits & (1 << 2));
114+
constexpr bool inner_const_range_models_input_range = static_cast<bool>(Bits & (1 << 3));
115+
constexpr bool inner_const_range_models_forward_range = static_cast<bool>(Bits & (1 << 4));
116+
constexpr bool const_v_models_common_range = static_cast<bool>(Bits & (1 << 5));
117+
constexpr bool inner_const_range_models_common_range = static_cast<bool>(Bits & (1 << 6));
118118

119119
constexpr ViewProperties inner_range_props{.common = inner_const_range_models_common_range};
120120
using InnerRange =

0 commit comments

Comments
 (0)