I am looking over the std::pair constructors and noticed that when I pass in the following example, the move on the std::unique_ptr works but the std::string does not get moved.
std::string my_str = std::string("Hello World!");
auto my_smartp = std::make_unique<const std::string>();
const std::string &my_str_ref = my_str;
// my_str_ref is fine, no move
// my_smartp is fine, no move
auto pair = std::pair<std::string, std::unique_ptr<const std::string>>(my_str_ref, std::move(my_smartp));
// my_str_ref is fine and was not moved
// my_smartp is has been moved to the std::pair
This makes no sense to me as the only constructor I can see valid for this example is (2), passing in two const references which, as far as I know, shouldn't trigger any move. Either they are both passed as temporary U1&& and U2&& or they are both passed as const references const T1& and const T2&.
I am using the latest clang if the implementation makes any difference.