[libcxx-commits] [libcxx] [libc++] LWG4324: `unique_ptr<void>::operator*` is not SFINAE-friendly (PR #190919)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Mon May 11 02:54:48 PDT 2026
================
@@ -117,6 +117,12 @@ struct __unique_ptr_deleter_sfinae<_Deleter&> {
typedef false_type __enable_rval_overload;
};
+template <class, class = void>
+inline const bool __can_dereference = false;
+
+template <class _Tp>
+inline const bool __can_dereference<_Tp, decltype((void)*std::declval<_Tp>())> = true;
----------------
frederick-vs-ja wrote:
It's not very easy to deduplicate them. Currently, `unique_ptr::operator*` permits the underlying `operator*` to return `void` (which is a bit pathological, though). However, `__dereferenceable` requires the underlying `operator*` to return a reference or object type.
https://github.com/llvm/llvm-project/pull/190919
More information about the libcxx-commits
mailing list