Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

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
37 of 39 checks passed
@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