The simple code below would not compile using Clang on Mac,
void foo(std::vector<std::unique_ptr<int> > &fromVector,
std::multiset<std::unique_ptr<int> > &fromMultiset) {
std::vector<std::unique_ptr<int> > to;
auto fv = fromVector.begin();
to.push_back(std::move(*fv));
auto fms = fromMultiset.begin();
to.push_back(std::move(*fms));
}
Compiler complains that pushing back rvalue obtained by std::move(*fms) necessitates invocation of deleted copy constructor. On the other hand Clang seems to be happy with similar operation on vector. Am I doing something wrong?