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

            Bug ID: 90389
           Summary: std::deque::emplace tries to call wrong overload
                    internally
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikedlui+gccbugzilla at gmail dot com
  Target Milestone: ---

Example: 

    #include <deque>
    #include <cstdint>

    struct Foo {};
    struct Bar {
        Bar(Foo f1, Foo f2, size_t c) {}
    };

    int main() {
        std::deque<Bar> deq;
        deq.emplace(deq.cbegin(), Foo{}, Foo{}, size_t{});
    }

https://godbolt.org/z/Bqw5Qv

It looks like when instantiating `std::deque::emplace`, an incorrect overload
to:

 template <typename _Tp, typename _Alloc>
    template <typename _ForwardIterator>
      void
      deque<_Tp, _Alloc>::
      _M_insert_aux(iterator __pos,
                    _ForwardIterator __first, _ForwardIterator __last,
                    size_type __n);

is chosen instead of the expected:

 template<typename... _Args>
      typename deque<_Tp, _Alloc>::iterator
      deque<_Tp, _Alloc>::
      _M_insert_aux(iterator __pos, _Args&&... __args);

Reply via email to