[libcxx-commits] [libcxx] [libc++] Make std::pair trivially copyable if its members are (PR #89652)

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 23 10:05:03 PDT 2024


cjdb wrote:

We're seeing errors to the effect of the following internally:
```
/tmp/a_file.cc:37:9: error: use of overloaded operator '=' is ambiguous (with operand types 'value_type' (aka 'std::pair<SomethingNotTriviallyCopyable, std::string_view>') and 'void')
   37 |     kv_ = {};
      |     ~~~ ^ ~~
/tmp/libcxx/include/__utility/pair.h:94:41: note: candidate function
   94 |   _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(const pair&)
      |                                         ^
/tmp/libcxx/include/__utility/pair.h:98:41: note: candidate function
   98 |   _LIBCPP_HIDE_FROM_ABI constexpr pair& operator=(pair&&)
      |                                         ^
/tmp/libcxx/include/__utility/pair.h:261:3: note: candidate function
  261 |   operator=(__conditional_t<!__has_defaulted_members::value && is_copy_assignable<first_type>::value &&
      |   ^
/tmp/libcxx/include/__utility/pair.h:272:3: note: candidate function
  272 |   operator=(__conditional_t<!__has_defaulted_members::value && is_move_assignable<first_type>::value &&
      |   ^
/tmp/libcxx/include/__utility/pair.h:99:14: note: similar constraint expressions not considered equivalent; constraint expressions cannot be considered equivalent unless they originate from the same concept
   99 |     requires __has_defaulted_members::value
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/libcxx/include/__utility/pair.h:95:14: note: similar constraint expression here
   95 |     requires __has_defaulted_members::value
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

I think we'll need to roll this back, and I will work with @philnik777 to get it back in ASAP.

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


More information about the libcxx-commits mailing list