[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
Fri May 22 12:14:15 PDT 2026


frederick-vs-ja wrote:

> ```
> % cat test.cc
> #include <algorithm>
> #include <memory>
> #include <ranges>
> #include <vector>
> 
> class C {};
> 
> std::vector<C> f(std::vector<std::unique_ptr<C>>& forms) {
>   std::vector<C> result;
>   result.reserve(forms.size());
>   std::ranges::transform(
>       forms, std::back_inserter(result),
>       &std::unique_ptr<C>::operator*);
>   return result;
> }
> ```

There's a related CWG issue: [CWG2608](https://cplusplus.github.io/CWG/issues/2608.html). It seems that Clang hasn't implement CWG2608. Such code will be "unbroken" once Clang implements it, but we should not rely on this.

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


More information about the libcxx-commits mailing list