Skip to content

Commit

Permalink
Fix debug compile error in gather_struct_tests.cpp (#8554)
Browse files Browse the repository at this point in the history
Building libcudf in debug resulted in a compile error introduced by #8527 

```
../tests/copying/gather_struct_tests.cpp:87:32: error: suggest parentheses around ‘&&’ within ‘||’ [-Werror=parentheses]
   87 |       assert(gather_index >= 0 && gather_index < gather_map.size() ||
      |              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

This error only shows in a debug build. This PR fixes the this code by applying the parentheses as the error suggests.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Gera Shegalov (https://github.com/gerashegalov)
  - Nghia Truong (https://github.com/ttnghia)
  - MithunR (https://github.com/mythrocks)

URL: #8554
  • Loading branch information
davidwendt authored Jun 21, 2021
1 parent f71c6fe commit 93fadf3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cpp/tests/copying/gather_struct_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ auto get_expected_column(std::vector<SourceElementT> const& input_values,
{
auto is_valid = // Validity predicate.
[&input_values, &input_validity, &struct_validity, &gather_map](auto gather_index) {
assert(gather_index >= 0 && gather_index < gather_map.size() || "Gather-index out of range.");
assert(
(gather_index >= 0 && gather_index < static_cast<cudf::size_type>(gather_map.size())) ||
"Gather-index out of range.");

auto i{gather_map[gather_index]}; // Index into input_values.

Expand Down

0 comments on commit 93fadf3

Please sign in to comment.