[Bug libstdc++/55043] [4.7/4.8 Regression] issue with nesting unordered_map containing unique_ptr into vector

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 24 01:08:00 GMT 2012


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-24 01:08:13 UTC ---
It already does use move_if_noexcept, so should work.

The problem is that
std::is_copy_constructible<std::unordered_set<std::unique_ptr<int>>>::value is
true, so __move_if_noexcept_cond is true for unordered containers and we try to
copy them.

That happens because this is well-formed:

    typedef std::unordered_set<std::unique_ptr<int>> S;
    decltype(::new S(std::declval<const S&>())) s;

That should be ill-formed, but for some reason isn't when it occurs as an
unevaluated operand.

This is ill-formed, as expected:

    S ss;
    ::new S(static_cast<const S&>(ss));



More information about the Gcc-bugs mailing list