From 8a1192c27af700f80bc4a99c384130fc506097a3 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 25 Jun 2025 14:10:23 +0000 Subject: [PATCH] Fix compile error when using `clang` with C++20. The extents type of the left hand side of those assignment are `extents`. But the extents type created on the right hand side by `raft::make_extents((i_t)FJ_MOVE_SIZE, (i_t)fj.pb_ptr->n_variables))` are `extents`. The former is constructible from the latter, but the documentation specific that this conversion is *explicit*: "This constructor is explicit if `((Extents != std::dynamic_extent && OtherExtents == std::dynamic_extent) || ...)` is true" The above condition holds in our case: (`FJ_MOVE_SIZE != dynamic_extent && dynamic_extents == dynamic_extent)` for the first extent. This ctor being explicit translates to the ctor of the mdspan being explicit, so in C++20, when the compiler enforces explicitness, we need to give it the exact extents type. --- .../mip/feasibility_jump/feasibility_jump.cu | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/cpp/src/mip/feasibility_jump/feasibility_jump.cu b/cpp/src/mip/feasibility_jump/feasibility_jump.cu index f3c60d094f..724a053cfc 100644 --- a/cpp/src/mip/feasibility_jump/feasibility_jump.cu +++ b/cpp/src/mip/feasibility_jump/feasibility_jump.cu @@ -175,20 +175,18 @@ fj_t::climber_data_t::view_t fj_t::climber_data_t::view() v.jump_move_delta = make_span(jump_move_delta); v.jump_move_delta_check = make_span(jump_move_delta_check); v.jump_move_score_check = make_span(jump_move_score_check); - v.move_last_update = raft::make_mdspan( - move_last_update.data(), - raft::make_extents((i_t)FJ_MOVE_SIZE, (i_t)fj.pb_ptr->n_variables)); - v.move_delta = raft::make_mdspan( - move_delta.data(), raft::make_extents((i_t)FJ_MOVE_SIZE, (i_t)fj.pb_ptr->n_variables)); - v.move_score = raft::make_mdspan( - move_score.data(), raft::make_extents((i_t)FJ_MOVE_SIZE, (i_t)fj.pb_ptr->n_variables)); - v.tabu_nodec_until = make_span(tabu_nodec_until); - v.tabu_noinc_until = make_span(tabu_noinc_until); - v.tabu_lastdec = make_span(tabu_lastdec); - v.tabu_lastinc = make_span(tabu_lastinc); - v.jump_candidates = make_span(jump_candidates); - v.jump_candidate_count = make_span(jump_candidate_count); - v.jump_locks = make_span(jump_locks); + const raft::extents move_extents( + (i_t)FJ_MOVE_SIZE, (i_t)fj.pb_ptr->n_variables); + v.move_last_update = raft::make_mdspan(move_last_update.data(), move_extents); + v.move_delta = raft::make_mdspan(move_delta.data(), move_extents); + v.move_score = raft::make_mdspan(move_score.data(), move_extents); + v.tabu_nodec_until = make_span(tabu_nodec_until); + v.tabu_noinc_until = make_span(tabu_noinc_until); + v.tabu_lastdec = make_span(tabu_lastdec); + v.tabu_lastinc = make_span(tabu_lastinc); + v.jump_candidates = make_span(jump_candidates); + v.jump_candidate_count = make_span(jump_candidate_count); + v.jump_locks = make_span(jump_locks); v.candidate_arrived_workids = make_span(candidate_arrived_workids); v.grid_score_buf = make_span(grid_score_buf); v.grid_delta_buf = make_span(grid_delta_buf);