diff --git a/include/sg14/aa_inplace_vector.h b/include/sg14/aa_inplace_vector.h index add333a..94632ef 100644 --- a/include/sg14/aa_inplace_vector.h +++ b/include/sg14/aa_inplace_vector.h @@ -360,9 +360,10 @@ struct SG14_INPLACE_VECTOR_TRIVIALLY_RELOCATABLE_IF((sg14::aaipv::be_trivially_r // There is a feature-test macro for "conditionally trivial SMFs," namely // (__cpp_concepts >= 202002L); but in fact neither GCC 11.4 nor AppleClang 15 // set that macro, despite supporting the feature (at least well enough to - // compile this code). So just check (__cplusplus >= 202002L) instead. + // compile this code). We could check (__cplusplus >= 202002L) instead, + // except that MSVC doesn't always set *that*! So check nothing, at least for now. // - static_assert(__cplusplus >= 202002L, "Allocator-aware inplace_vector requires that the compiler support conditionally trivial SMFs"); + static_assert(true, "Allocator-aware inplace_vector requires that the compiler support conditionally trivial SMFs"); static constexpr bool CopyCtorIsDefaultable = ((std::is_trivially_copy_constructible_v && diff --git a/test/aa_inplace_vector_smallsize_test.cpp b/test/aa_inplace_vector_smallsize_test.cpp index 90c3f63..f2517db 100644 --- a/test/aa_inplace_vector_smallsize_test.cpp +++ b/test/aa_inplace_vector_smallsize_test.cpp @@ -26,11 +26,22 @@ namespace smallsize { TEST(IPV_TEST_NAME, SizeAndAlignment) { +#ifdef _MSC_VER + // Our `ipv_alloc_holder` has a single [[no_unique_address]] member. + // Even using [[msvc::no_unique_address]], MSVC fails to treat + // `ipv_alloc_holder` as an empty base for the purposes of optimization, + // which means it occupies an extra byte compared to the Itanium ABI. + // + static constexpr bool msvc = true; +#else + static constexpr bool msvc = false; +#endif + static_assert(sizeof(sg14::inplace_vector) == 32); static_assert(alignof(sg14::inplace_vector) == 8); static_assert(sizeof(sg14::pmr::inplace_vector) == 40); static_assert(alignof(sg14::pmr::inplace_vector) == 8); - static_assert(sizeof(smallsize::inplace_vector) == 23); + static_assert(sizeof(smallsize::inplace_vector) == (msvc ? 24 : 23)); static_assert(alignof(smallsize::inplace_vector) == 1); static_assert(sizeof(smallsize::inplace_vector) == 3);