https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87194
Bug ID: 87194 Summary: Associative container cannot be inserted from move iterators that refer to elements implicitly convertible to value_type Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: kariya_mitsuru at hotmail dot com Target Milestone: --- The sample code below is failed to compile by GCC HEAD (Sep 1, 2018). =========================== sample code =========================== #include <array> #include <iterator> #include <set> #include <string> #include <utility> struct S { S(const char* s) : s(s) {} operator std::string() && { return std::move(s); } std::string s; }; int main() { std::array<S, 3> a{ "abc", "def", "ghi" }; std::set<std::string> s; s.insert(std::make_move_iterator(a.begin()), std::make_move_iterator(a.end())); } =========================== sample code =========================== cf. https://wandbox.org/permlink/c8rASYAgPKxRBUt0 The C++17 standard [associative.reqmts] says, p.8: ..., i and j satisfy input iterator requirements and refer to elements implicitly convertible to value_type, ... a.insert(i,j) in Table 90: Requires: value_type shall be EmplaceConstructible into X from *i. So, I think that the sample code should be coumpiled successfully. The unordered_set has the same problem. cf. https://wandbox.org/permlink/Q4pVJkFVSS2Qijrg But I don't know why, [unord.req] says that p.8: ..., i and j denote input iterators that refer to value_type, ... So, I am not sure that the unordered_set should be too.