https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77334

            Bug ID: 77334
           Summary: Cannot move assign std::map with non-copyable and
                    non-movable mapped_type
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: inadgob at yahoo dot com
  Target Milestone: ---

Consider the following code: 


#include <map>

struct A
{
   A(A&&) = delete;
};

int main()
{
   std::map<int, A> m1, m2;
   m2 = std::move(m1);
}


The move assignment is rejected; diagnostics here:
http://melpon.org/wandbox/permlink/s3MafVYFzQrUMN4F.

According to the allocator-aware container requirements table in
[container.requirements.general], there should be no special requirements on
value_type in this case, so the assignment should work.

This is due to the use of an if statement instead of tag dispatching to check
the allocator traits in the implementation of _Rb_tree's move assignment
operator. 

The issue seems to have appeared in version 4.9.0.

The example that prompted this bug report and more details are available here:
http://stackoverflow.com/q/39040609/4326278.

Reply via email to