[libcxx-commits] [libcxx] [libc++] LWG 3821 uses_allocator_construction_args should have overload for pair-like (PR #66939)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 21 14:21:24 PDT 2023


================
@@ -284,7 +284,8 @@ struct _LIBCPP_TEMPLATE_VIS pair
     }
 
     template <__pair_like _PairLike>
-      requires(is_constructible_v<first_type, decltype(std::get<0>(std::declval<_PairLike&&>()))> &&
+      requires(!__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value &&
----------------
huixie90 wrote:

I am bit struggled to test this.  It turns out that `subrange` has `operator PairLike`

Even with this constructor removed, the
```
std::pair p(subrange)
```
still works

i.e. with and without this constructor, we can always construct a `pair` from a `subrange`

This test still passes on my side after the change
[LWG 3525](https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.pair_like.pass.cpp#L85)

any idea of how to test this?

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


More information about the libcxx-commits mailing list