[libcxx-commits] [libcxx] [libc++] Simplify a bunch of noexcept specifications (PR #166397)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 8 07:54:05 PDT 2026
================
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03
+
+// <vector>
+
+#include <type_traits>
+#include <vector>
+
+#include "test_allocator.h"
+
+namespace std_allocator {
+using vec = std::vector<int>;
+
+static_assert(std::is_nothrow_constructible<vec>::value);
----------------
ldionne wrote:
Instead of adding a `noexcept.compile.pass` test under `libcxx/test/libcxx`, let's go to each operation's existing tests under `libcxx/test/std` and add a `LIBCPP_STATIC_ASSERT` for the right noexcept-ness. It would catch things like the missed update to
```
#if TEST_STD_VER > 14
static_assert((noexcept(C{typename C::allocator_type{}})), "");
#elif TEST_STD_VER >= 11
static_assert((noexcept(C(typename C::allocator_type())) ==
std::is_nothrow_copy_constructible<typename C::allocator_type>::value),
"");
```
in `libcxx/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp`.
https://github.com/llvm/llvm-project/pull/166397
More information about the libcxx-commits
mailing list