[libcxx-commits] [libcxx] [libc++] Strengthen optional value constructor noexcept (PR #202765)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 10 07:53:06 PDT 2026


================
@@ -98,6 +107,10 @@ void test_implicit() {
     static_assert(!test_convertible<O, std::in_place_t&&>(), "");
     static_assert(!test_convertible<O, const std::in_place_t&&>(), "");
   }
+  {
+    ASSERT_NOEXCEPT(optional<ImplicitNoThrow>(42));
----------------
ldionne wrote:

Since these noexcepts are strenghtening the standard, we should either move those tests to `test/libcxx/[...]`, or use `LIBCPP_ASSERT_NOEXCEPT` instead (which is specific to libc++).

The general idea is that libc++'s test suite is also used to check other implementations, so we need to be careful when we test things that are not strictly speaking required by the specification for a conforming implementation. Otherwise, another conforming implementation that differs on that point would fail these tests.

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


More information about the libcxx-commits mailing list