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++/55043] [4.7/4.8 Regression] issue with nesting unordered_map containing unique_ptr into vector


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

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-24 15:40:28 UTC ---
(In reply to comment #14)

> I think it is implementable (I have done something similar to ensure that my
> optional<T> realizes the same effect), but the costs are not small:
> 
> 1) It will prevent the incomplete type support

Ouch... but not required by the standard.

> 2) The implementation changes are not small (my guess)

Apart from the changes to allocator_traits and defining CopyInsertable etc.
(which I think isn't so hard, I can do that tonight) IIUC it would require
changing every container so that e.g.

    vector<T,A>::vector(const vector&)

becomes

    template<typename U>
      vector<T,A>::vector(const vector<U,A>&)

with constraints is_same<T,U> and CopyInsertable<A,T>, because we can't
constrain that constructor if it's not a template

Is that even allowed under the as-if rule?

Do we really want to go there?

Is there some other way to make examples like this compile?

  #include <vector>

  struct M
  {
    M() = default;
    M(M&&) = default;
    M& operator=(M&&) = default;
  };

  typedef std::vector<M> S;

  static_assert( !std::is_copy_constructible<S>::value,
                 "not CopyConstructible" );


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