Skip to content

Commit

Permalink
Fixed a warning coming from MSVC in algebra::cmath::vector_getter.
Browse files Browse the repository at this point in the history
It showed up while trying to build detray with MSVC.

Added code for triggering the issue, so that this project would check
that function explicitly as well. Even if the return value of that
function is not checked. Because that return value is not independent
of the plugin type being used...
  • Loading branch information
krasznaa committed Feb 9, 2022
1 parent e82eda3 commit 50a184c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion math/cmath/include/algebra/math/impl/cmath_getter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct vector_getter {
ALGEBRA_HOST_DEVICE inline result_type operator()(
const matrix_type<ROWS, COLS> &m, std::size_t row, std::size_t col) {

result_type subvector;
result_type subvector{};
for (std::size_t irow = row; irow < row + SIZE; ++irow) {
subvector[irow - row] = m[col][irow];
}
Expand Down
5 changes: 5 additions & 0 deletions tests/common/test_host_basics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ TYPED_TEST_P(test_host_basics, transform3) {
auto m44 = trf2.matrix();
typename TypeParam::transform3 trfm(m44);

// Make sure that algebra::getter:vector can be called.
(void)algebra::getter::vector<3>(m44, 0, 0);
(void)algebra::getter::vector<3>(m44, 0, 1);
(void)algebra::getter::vector<3>(m44, 0, 2);

// Re-evaluate rot and trn
auto rotm = trfm.rotation();
ASSERT_NEAR(element_getter(rotm, 0, 0), x[0], this->m_epsilon);
Expand Down

0 comments on commit 50a184c

Please sign in to comment.