File tree 2 files changed +33
-2
lines changed
test/std/utilities/utility/pairs/pairs.pair 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -274,9 +274,9 @@ struct _LIBCPP_TEMPLATE_VIS pair
274
274
275
275
# if _LIBCPP_STD_VER >= 23
276
276
// This is a workaround for http://llvm.org/PR60710. We should be able to remove it once Clang is fixed.
277
- template <class _PairLike , bool _Enable = tuple_size< remove_cvref_t <_PairLike>>::value == 2 >
277
+ template <class _PairLike >
278
278
_LIBCPP_HIDE_FROM_ABI static constexpr bool __pair_like_explicit_wknd () {
279
- if constexpr (tuple_size< remove_cvref_t < _PairLike>>::value == 2 ) {
279
+ if constexpr (__pair_like< _PairLike>) {
280
280
return !is_convertible_v<decltype (std::get<0 >(std::declval<_PairLike&&>())), first_type> ||
281
281
!is_convertible_v<decltype (std::get<1 >(std::declval<_PairLike&&>())), second_type>;
282
282
}
Original file line number Diff line number Diff line change 23
23
#include < type_traits>
24
24
#include < utility>
25
25
26
+ namespace my_ns {
27
+
28
+ struct MyPairLike {
29
+
30
+ template <std::size_t N>
31
+ friend int get (MyPairLike const &)
32
+ {
33
+ return 0 ;
34
+ }
35
+
36
+ };
37
+
38
+ } // namespace my_ns
39
+
40
+ namespace std {
41
+
42
+ template <>
43
+ struct tuple_size <my_ns::MyPairLike> : std::integral_constant<std::size_t , 2 > {};
44
+
45
+ template <std::size_t N>
46
+ struct tuple_element <N, my_ns::MyPairLike> {
47
+ using type = int ;
48
+ };
49
+
50
+ } // namespace std
51
+
52
+ // https://github.com/llvm/llvm-project/issues/65620
53
+ // This used to be a hard error
54
+ static_assert (!std::is_constructible_v<std::pair<int ,int >, my_ns::MyPairLike const &>);
55
+
56
+
26
57
constexpr bool test () {
27
58
// Make sure construction works from array, tuple, and ranges::subrange
28
59
{
You can’t perform that action at this time.
0 commit comments