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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 15 08:09:37 PDT 2025


================
@@ -20,15 +18,13 @@
 _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");
----------------
ldionne wrote:

These static asserts were likely added because we like to match every `Mandates` in the Standard with a `static_assert`. I'd be okay with removing the assertions, but let's leave a comment behind to say that these Mandates are already diagnosed by the builtin.

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


More information about the libcxx-commits mailing list