[libcxx-commits] [libcxx] [libc++][unique_ptr] Implement LWG 4144: Disallow unique_ptr<T&, D> (PR #209018)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 12 23:28:56 PDT 2026


================
@@ -111,6 +118,8 @@ class _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI unique_ptr {
 public:
   typedef _Tp element_type;
   typedef _Dp deleter_type;
+
+  static_assert(__is_pointable<_Tp>, "unique_ptr<T, D> requires T* to be a valid type");
----------------
frederick-vs-ja wrote:

Good point. Then would you mind to to bring both `static_assert`'s to the top of the class definition (or immediately below `public:`), and change `!is_rvalue_reference<deleter_type>::value` to `!is_rvalue_reference<_Dp>::value`?

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


More information about the libcxx-commits mailing list