From 1d44c628b3a7e89265f2f92591b5dad5734427d3 Mon Sep 17 00:00:00 2001 From: Christian Trott Date: Tue, 28 Apr 2020 18:46:06 -0600 Subject: [PATCH] Workaround build issues with MSVC for gtest based builds. --- compilation_tests/ctest_constexpr_subspan.cpp | 19 +++++++++++++++++++ compilation_tests/ctest_no_unique_address.cpp | 3 +++ compilation_tests/ctest_standard_layout.cpp | 3 +++ 3 files changed, 25 insertions(+) diff --git a/compilation_tests/ctest_constexpr_subspan.cpp b/compilation_tests/ctest_constexpr_subspan.cpp index a4089587..a29df0ce 100644 --- a/compilation_tests/ctest_constexpr_subspan.cpp +++ b/compilation_tests/ctest_constexpr_subspan.cpp @@ -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()); MDSPAN_STATIC_TEST(dynamic_extent_1d_pair_each()); MDSPAN_STATIC_TEST(dynamic_extent_1d_pair_each>()); +#endif // end 1D dynamic extent pair slice subspan }}}1 //============================================================================== @@ -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()); MDSPAN_STATIC_TEST(dynamic_extent_1d_all_three()); MDSPAN_STATIC_TEST(dynamic_extent_1d_all_three>()); +#endif // end 1D dynamic extent pair, all, ptrdifft slice }}}1 //============================================================================== @@ -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()); MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx()); MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx>()); MDSPAN_STATIC_TEST(dynamic_extent_2d_idx_all_idx>()); +#endif //============================================================================== @@ -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 @@ -256,6 +268,7 @@ MDSPAN_STATIC_TEST( // -1 - 2 - 3 + 7 + 8 + 9 = 18 stdex::mdspan{nullptr}.extent(0) == 18 ); +#endif //============================================================================== @@ -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 //============================================================================== @@ -332,12 +348,15 @@ mixed_subspan_test_3() { return result == 71; } +// MSVC ICE +#ifndef _MDSPAN_COMPILER_MSVC MDSPAN_STATIC_TEST( mixed_subspan_test_3() ); MDSPAN_STATIC_TEST( mixed_subspan_test_3>() ); +#endif //============================================================================== diff --git a/compilation_tests/ctest_no_unique_address.cpp b/compilation_tests/ctest_no_unique_address.cpp index 864a4e64..1252b346 100644 --- a/compilation_tests/ctest_no_unique_address.cpp +++ b/compilation_tests/ctest_no_unique_address.cpp @@ -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::template mapping< stdex::extents<3, 4, 5> >>::value ); +#endif // end layouts }}}1 //============================================================================== diff --git a/compilation_tests/ctest_standard_layout.cpp b/compilation_tests/ctest_standard_layout.cpp index 3e99b955..040d5dcd 100644 --- a/compilation_tests/ctest_standard_layout.cpp +++ b/compilation_tests/ctest_standard_layout.cpp @@ -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::value ); +#endif // end layouts }}}1 //==============================================================================