http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53657
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |4.5.1, 4.6.0 Target Milestone|--- |4.7.2 Summary|[C++11] pair(pair&&) move |[4.7/4.8 Regression][C++11] |constructor is non-trivial |pair(pair&&) move | |constructor is non-trivial Known to fail| |4.5.0 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work|4.5.1, 4.6.0 | Target Milestone|4.7.2 |--- Summary|[4.7/4.8 Regression][C++11] |[C++11] pair(pair&&) move |pair(pair&&) move |constructor is non-trivial |constructor is non-trivial | Known to fail|4.5.0 | --- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-14 09:39:58 UTC --- Thanks. --- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-06-14 09:40:44 UTC --- The issue is related to LWG2005, and can be summarized with the following testcase, which should not trigger the static_assert. In short, if we want std::pair' move constructor defaulted, we have to use std::is_constructible, not std::is_convertible, to constrain container::insert. If people agree with my assessment - I don't see what else we could possibly do on the library side - I can try again moving the latter to use std::is_constructible, should mostly work. ///////////////// #include <type_traits> #include <utility> struct move_only { move_only(const move_only&) = delete; move_only(move_only&&) = default; }; template<typename _T1, typename _T2> struct pair { pair(pair&&) = default; template<class _U1, class _U2> pair(pair<_U1, _U2>&& __p) : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) { } _T1 first; _T2 second; }; typedef pair<move_only, move_only> Pair; typedef pair<const move_only, move_only> CPair; static_assert(std::is_convertible<Pair, CPair>::value, "Error"); //static_assert(std::is_constructible<CPair, Pair&&>::value, "Error");