This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/55043] [4.7/4.8 Regression] issue with nesting unordered_map containing unique_ptr into vector
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Oct 2012 01:08:13 +0000
- Subject: [Bug libstdc++/55043] [4.7/4.8 Regression] issue with nesting unordered_map containing unique_ptr into vector
- Auto-submitted: auto-generated
- References: <bug-55043-4@http.gcc.gnu.org/bugzilla/>
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));