Skip to content

[libc++][test] Use LIBCPP_STATIC_ASSERT for std::__mdspan_detail#73436

Merged
StephanTLavavej merged 1 commit intollvm:mainfrom
StephanTLavavej:stl-2-libcpp-static-assert
Nov 27, 2023
Merged

[libc++][test] Use LIBCPP_STATIC_ASSERT for std::__mdspan_detail#73436
StephanTLavavej merged 1 commit intollvm:mainfrom
StephanTLavavej:stl-2-libcpp-static-assert

Conversation

@StephanTLavavej
Copy link
Member

Found while running libc++'s test suite against MSVC's STL.

libcxx/test/std should be portable, so these lines checking std::__mdspan_detail machinery should be using LIBCPP_STATIC_ASSERT.

I checked for other occurrences and these appear to be the only ones which have appeared since our last libc++ test suite update.

@StephanTLavavej StephanTLavavej requested a review from a team as a code owner November 26, 2023 10:41
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 26, 2023
@llvmbot
Copy link
Member

llvmbot commented Nov 26, 2023

@llvm/pr-subscribers-libcxx

Author: Stephan T. Lavavej (StephanTLavavej)

Changes

Found while running libc++'s test suite against MSVC's STL.

libcxx/test/std should be portable, so these lines checking std::__mdspan_detail machinery should be using LIBCPP_STATIC_ASSERT.

I checked for other occurrences and these appear to be the only ones which have appeared since our last libc++ test suite update.


Full diff: https://github.com/llvm/llvm-project/pull/73436.diff

3 Files Affected:

  • (modified) libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp (+1-1)
  • (modified) libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp (+1-1)
diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
index b74d129946d40dd..366498803a2ded5 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_left/static_requirements.pass.cpp
@@ -87,7 +87,7 @@
 template <class M, size_t... Idxs>
 void test_mapping_requirements(std::index_sequence<Idxs...>) {
   using E = typename M::extents_type;
-  static_assert(std::__mdspan_detail::__is_extents_v<E>);
+  LIBCPP_STATIC_ASSERT(std::__mdspan_detail::__is_extents_v<E>);
   static_assert(std::is_copy_constructible_v<M>);
   static_assert(std::is_nothrow_move_constructible_v<M>);
   static_assert(std::is_nothrow_move_assignable_v<M>);
diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
index 33e736b15029c7d..d460f1a5dbc468a 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_right/static_requirements.pass.cpp
@@ -87,7 +87,7 @@
 template <class M, size_t... Idxs>
 void test_mapping_requirements(std::index_sequence<Idxs...>) {
   using E = typename M::extents_type;
-  static_assert(std::__mdspan_detail::__is_extents_v<E>);
+  LIBCPP_STATIC_ASSERT(std::__mdspan_detail::__is_extents_v<E>);
   static_assert(std::is_copy_constructible_v<M>);
   static_assert(std::is_nothrow_move_constructible_v<M>);
   static_assert(std::is_nothrow_move_assignable_v<M>);
diff --git a/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp b/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
index 112f4b9e5a04033..b56d0087260d1fc 100644
--- a/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/layout_stride/static_requirements.pass.cpp
@@ -87,7 +87,7 @@
 template <class M, size_t... Idxs>
 void test_mapping_requirements(std::index_sequence<Idxs...>) {
   using E = typename M::extents_type;
-  static_assert(std::__mdspan_detail::__is_extents_v<E>);
+  LIBCPP_STATIC_ASSERT(std::__mdspan_detail::__is_extents_v<E>);
   static_assert(std::is_copy_constructible_v<M>);
   static_assert(std::is_nothrow_move_constructible_v<M>);
   static_assert(std::is_nothrow_move_assignable_v<M>);

@StephanTLavavej StephanTLavavej merged commit b84cb9c into llvm:main Nov 27, 2023
@StephanTLavavej
Copy link
Member Author

Merged as the CI had only unrelated failures in

std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
std/input.output/stream.buffers/streambuf/streambuf.protected/streambuf.put.area/pbump2gig.pass.cpp
std/input.output/string.streams/stringstream/stringstream.members/gcount.pass.cpp
std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp

none of which were changed here. Thanks!

@StephanTLavavej StephanTLavavej deleted the stl-2-libcpp-static-assert branch November 27, 2023 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants