This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/53657] New: [C++11] pair(pair&&) move constructor is non-trivial


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53657

             Bug #: 53657
           Summary: [C++11] pair(pair&&) move constructor is non-trivial
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org
                CC: paolo.carlini@oracle.com


As discussed in PR 53646 the std::pair move constructor is non-trivial and so
causes an unfortunate ABI change where std::pair gets returned from functions
by invisible reference instead of in registers.

Defaulting it makes it trivial, but causes other problems:

      // XXX Defaulted?!? Breaks std::map!!!
      pair(pair&& __p)
      noexcept(__and_<is_nothrow_move_constructible<_T1>,
                      is_nothrow_move_constructible<_T2>>::value)
      : first(std::forward<first_type>(__p.first)),
        second(std::forward<second_type>(__p.second)) { }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]