[libcxx-commits] [libcxx] [libc++][test] Use `LIBCPP_STATIC_ASSERT` to deal with `noexcept` strengthening (PR #74254)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 3 14:12:50 PST 2023


================
@@ -141,12 +141,12 @@ constexpr void test_mdspan_types(const H& handle, const M& map, const A& acc) {
   ASSERT_SAME_TYPE(decltype(m.is_unique()), bool);
   ASSERT_SAME_TYPE(decltype(m.is_exhaustive()), bool);
   ASSERT_SAME_TYPE(decltype(m.is_strided()), bool);
-  assert(!noexcept(MDS::is_always_unique()));
-  assert(!noexcept(MDS::is_always_exhaustive()));
-  assert(!noexcept(MDS::is_always_strided()));
-  assert(!noexcept(m.is_unique()));
-  assert(!noexcept(m.is_exhaustive()));
-  assert(!noexcept(m.is_strided()));
+  LIBCPP_STATIC_ASSERT(!noexcept(MDS::is_always_unique()));
----------------
philnik777 wrote:

@crtrott Why have we added these tests in the first place? And why doesn't the standard require them to be `noexcept`? From what I can tell, these should meet the Lakos rule requirements. Same questions for the other mdspan changes.

https://github.com/llvm/llvm-project/pull/74254


More information about the libcxx-commits mailing list