[libcxx-commits] [libcxx] [libc++] Simplify std::launder (PR #147985)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 15 10:12:54 PDT 2025


================
@@ -20,15 +18,14 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 template <class _Tp>
 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT {
-  static_assert(!(is_function<_Tp>::value), "can't launder functions");
-  static_assert(!is_void<_Tp>::value, "can't launder cv-void");
+  // The compiler diagnoses misuses of __builtin_launder, so we don't need to add any static_asserts.
----------------
ldionne wrote:

```suggestion
  // The compiler diagnoses misuses of __builtin_launder, so we don't need to add any static_asserts
  // to implement the Mandates.
```

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


More information about the libcxx-commits mailing list