This is the mail archive of the gcc-patches@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]

[v3] libstdc++/55979 (+ notes about 55977)


Hi,

I had a look to these two PRs and, as regards the former, the below patchlet seems Ok to me even for 4.8.1.

About the latter: a similar change works fine for std::vector and std::deque, but std::list for example has another problem, which is already exposed by the v1.emplace_back(i); bit and seems unrelated: we have:

  template<typename _Tp>
    struct _List_node : public __detail::_List_node_base
    {
      ///< User's data.
      _Tp _M_data;

#if __cplusplus >= 201103L
      template<typename... _Args>
        _List_node(_Args&&... __args)
    : __detail::_List_node_base(), _M_data(std::forward<_Args>(__args)...)
        { }
#endif
    };

together with:

      template<typename... _Args>
        _Node*
        _M_create_node(_Args&&... __args)
    {
      _Node* __p = this->_M_get_node();
      __try
        {
          _M_get_Node_allocator().construct(__p,
                        std::forward<_Args>(__args)...);
        }
      __catch(...)
        {
          _M_put_node(__p);
          __throw_exception_again;
        }
      return __p;
    }

and this is not Ok in terms of access control, because _List_node tries to use the constructor, not the allocator (not sure how strict the Standard is in terms of access control)

I guess we could at least work around the problem by going back to _M_get_Tp_allocator().construct in _M_create_node (or, better, the allocator_traits<>::construct equivalent, per the recent fix for 56613; we would use it on _Tp actually, everywhere) but I don't know if Jon has already something in his tree for this batch of issues regarding our base container class / node constructors, or we want to decouple the issue from 55977, do std::vector and std::deque, which would be trivial even for 4.8.1, or something else. Suggestions?

Thanks!
Paolo.

//////////////////////////

Attachment: CL_55979
Description: Text document

Attachment: patch_55979
Description: Text document


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