https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118079

            Bug ID: 118079
           Summary: std::deque has too many overloads called _M_insert_aux
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <deque>

struct X
{
  template<typename T>
    X(T, T, std::size_t)
    { }
};

int main() {
  std::deque<X> d;
  d.emplace(d.begin(), d.begin(), d.begin(), std::size_t(0));
}

This should just insert an X but emplace calls:

          return _M_insert_aux(__position._M_const_cast(),
                               std::forward<_Args>(__args)...);

This is supposed to call this overload:

      template<typename... _Args>
        iterator
        _M_insert_aux(iterator __pos, _Args&&... __args);

but it's a perfect match for:

      // called by range_insert_aux for forward iterators
      template<typename _ForwardIterator>
        void
        _M_insert_aux(iterator __pos,
                      _ForwardIterator __first, _ForwardIterator __last,
                      size_type __n);

which is a completely different function with different semantics (and a void
return type).

There's no reason all these different _M_insert_aux helpers should have the
same name.

Reply via email to