Skip to content

Commit

Permalink
Workaround build issues with MSVC for gtest based builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott authored and D. S. Hollman committed Apr 29, 2020
1 parent 0f07622 commit 1d44c62
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions compilation_tests/ctest_constexpr_subspan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ dynamic_extent_1d_pair_each() {
return result == 15;
}

// MSVC ICE
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(dynamic_extent_1d_pair_each<stdex::layout_left>());
MDSPAN_STATIC_TEST(dynamic_extent_1d_pair_each<stdex::layout_right>());
MDSPAN_STATIC_TEST(dynamic_extent_1d_pair_each<stdex::layout_stride<1>>());
#endif

// </editor-fold> end 1D dynamic extent pair slice subspan }}}1
//==============================================================================
Expand All @@ -168,9 +171,12 @@ dynamic_extent_1d_all_three() {
return result == 15;
}

// MSVC ICE
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(dynamic_extent_1d_all_three<stdex::layout_left>());
MDSPAN_STATIC_TEST(dynamic_extent_1d_all_three<stdex::layout_right>());
MDSPAN_STATIC_TEST(dynamic_extent_1d_all_three<stdex::layout_stride<1>>());
#endif

// </editor-fold> end 1D dynamic extent pair, all, ptrdifft slice }}}1
//==============================================================================
Expand Down Expand Up @@ -216,10 +222,14 @@ dynamic_extent_2d_idx_all_idx() {
constexpr_assert_equal(21, result);
return result == 21;
}

// MSVC ICE
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx<stdex::layout_left>());
MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx<stdex::layout_right>());
MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx<stdex::layout_stride<1, 2>>());
MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx<stdex::layout_stride<3, 1>>());
#endif

//==============================================================================

Expand All @@ -242,6 +252,8 @@ simple_static_subspan_test_1(int add_to_row) {
return result;
}

// MSVC ICE
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(
// 1 + 2 + 3 + 2*(4 + 5 + 6) + 3*(7 + 8 + 9) = 108
simple_static_subspan_test_1(1) == 108
Expand All @@ -256,6 +268,7 @@ MDSPAN_STATIC_TEST(
// -1 - 2 - 3 + 7 + 8 + 9 = 18
stdex::mdspan<double, simple_static_subspan_test_1(-1)>{nullptr}.extent(0) == 18
);
#endif

//==============================================================================

Expand Down Expand Up @@ -293,10 +306,13 @@ mixed_subspan_left_test_2() {
return result == 108;
}

// MSVC ICE
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(
// 2 * (1 + 2 + 3 + 2*(4 + 5 + 6) + 3*(7 + 8 + 9)) / 2 = 108
mixed_subspan_left_test_2()
);
#endif

//==============================================================================

Expand Down Expand Up @@ -332,12 +348,15 @@ mixed_subspan_test_3() {
return result == 71;
}

// MSVC ICE
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(
mixed_subspan_test_3<stdex::layout_right>()
);
MDSPAN_STATIC_TEST(
mixed_subspan_test_3<stdex::layout_stride<5, 1>>()
);
#endif

//==============================================================================

Expand Down
3 changes: 3 additions & 0 deletions compilation_tests/ctest_no_unique_address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,14 @@ MDSPAN_STATIC_TEST(
>) == 2 * sizeof(ptrdiff_t)
);

// Fails on MSVC which adds some padding
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(
std::is_empty<stdex::layout_stride<3, 4, 5>::template mapping<
stdex::extents<3, 4, 5>
>>::value
);
#endif

// </editor-fold> end layouts }}}1
//==============================================================================
Expand Down
3 changes: 3 additions & 0 deletions compilation_tests/ctest_standard_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,12 @@ struct layout_stride_as_member_should_be_standard_layout :
int foo;
};

// Fails with MSVC which adds some padding
#ifndef _MDSPAN_COMPILER_MSVC
MDSPAN_STATIC_TEST(
std::is_standard_layout<layout_stride_as_member_should_be_standard_layout>::value
);
#endif

// </editor-fold> end layouts }}}1
//==============================================================================
Expand Down

0 comments on commit 1d44c62

Please sign in to comment.