@@ -241,7 +241,7 @@ TYPED_TEST(simd_vec_fixture, StoreByDefaultIsUnaligned)
241241 const auto scalars{integer_sequence<TypeParam>()};
242242 const TypeParam vector{scalars};
243243 std::array<typename TypeParam::value_type, vector.size ()> result;
244- vector. copy_to ( result. data () );
244+ score::cpp::simd::unchecked_store (vector, result);
245245
246246 EXPECT_EQ (result, scalars);
247247}
@@ -253,7 +253,7 @@ TYPED_TEST(simd_vec_fixture, StoreUnaligned)
253253 const auto scalars{integer_sequence<TypeParam>()};
254254 const TypeParam vector{scalars};
255255 std::array<typename TypeParam::value_type, vector.size ()> result;
256- vector. copy_to ( result. data () , score::cpp::simd::element_aligned);
256+ score::cpp::simd::unchecked_store (vector, result, score::cpp::simd::element_aligned);
257257
258258 EXPECT_EQ (result, scalars);
259259}
@@ -266,7 +266,7 @@ TYPED_TEST(simd_vec_fixture, StoreAligned)
266266 const auto scalars{integer_sequence<TypeParam>()};
267267 const TypeParam vector{scalars};
268268 alignas (score::cpp::simd::alignment_v<TypeParam>) std::array<value_type, vector.size ()> result;
269- vector. copy_to ( result. data () , score::cpp::simd::vector_aligned);
269+ score::cpp::simd::unchecked_store (vector, result, score::cpp::simd::vector_aligned);
270270
271271 EXPECT_EQ (result, scalars);
272272}
@@ -283,8 +283,38 @@ TYPED_TEST(simd_vec_fixture, StoreAligned_WhenCopyingToUnalignedMemory_ThenPreco
283283 using value_type = typename TypeParam::value_type;
284284 const TypeParam vector{value_type{23 }};
285285 alignas (score::cpp::simd::alignment_v<TypeParam>) std::array<value_type, vector.size () + 1U > scalars;
286+ const score::cpp::span<value_type, TypeParam::size ()> result{&scalars[1U ], vector.size ()};
286287
287- SCORE_LANGUAGE_FUTURECPP_EXPECT_CONTRACT_VIOLATED (vector.copy_to (&scalars[1 ], score::cpp::simd::vector_aligned));
288+ SCORE_LANGUAGE_FUTURECPP_EXPECT_CONTRACT_VIOLATED (score::cpp::simd::unchecked_store (vector, result, score::cpp::simd::vector_aligned));
289+ }
290+
291+ // / @testmethods TM_REQUIREMENT
292+ // / @requirement CB-#18398050
293+ TYPED_TEST (simd_vec_fixture, CannotConstruct_WhenSizeIsNotAConstantExpression)
294+ {
295+ const auto test = [](auto && r) -> decltype (score::cpp::simd::unchecked_store (std::declval<TypeParam>(),
296+ std::forward<decltype (r)>(r))) {};
297+
298+ using value_type = typename TypeParam::value_type;
299+
300+ { // cannot call `unchecked_store` because types have runtime size
301+ static_assert (!std::is_invocable_v<decltype (test), std::vector<value_type>>);
302+ static_assert (!std::is_invocable_v<decltype (test), std::vector<value_type>&>);
303+ static_assert (!std::is_invocable_v<decltype (test), score::cpp::span<value_type>>);
304+ static_assert (!std::is_invocable_v<decltype (test), score::cpp::span<value_type>&>);
305+ }
306+
307+ { // cannot store to range because it is `const`, i.e., non-modifiable
308+ static_assert (!std::is_invocable_v<decltype (test), score::cpp::span<const value_type, TypeParam::size ()>>);
309+ static_assert (!std::is_invocable_v<decltype (test), score::cpp::span<const value_type, TypeParam::size ()>&>);
310+ static_assert (!std::is_invocable_v<decltype (test), std::array<value_type, TypeParam::size ()>>);
311+ }
312+
313+ { // sanity check that test works
314+ static_assert (std::is_invocable_v<decltype (test), score::cpp::span<value_type, TypeParam::size ()>>);
315+ static_assert (std::is_invocable_v<decltype (test), score::cpp::span<value_type, TypeParam::size ()>&>);
316+ static_assert (std::is_invocable_v<decltype (test), std::array<value_type, TypeParam::size ()>&>);
317+ }
288318}
289319
290320// / @testmethods TM_REQUIREMENT
0 commit comments