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

             Bug #: 52799
           Summary: deque::emplace(iterator, ...) tries to call
                    push_front(...), which doesn't exist
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jyass...@gcc.gnu.org


$ cat emplace.cc
#include <deque>

int main() {
  std::deque<int> d;
  d.emplace(d.begin());
}
$ g++-4.8pre --version
g++-4.8pre (GCC) 4.8.0 20120330 (experimental)
$ g++-4.8pre -std=c++11 emplace.cc -c -o /dev/null
In file included from .../include/c++/4.8.0/deque:67:0,
                 from emplace.cc:1:
.../include/c++/4.8.0/bits/deque.tcc: In instantiation of ‘std::deque<_Tp,
_Alloc>::iterator std::deque<_Tp, _Alloc>::emplace(std::deque<_Tp,
_Alloc>::iterator, _Args&& ...) [with _Args = {}; _Tp = int; _Alloc =
std::allocator<int>; std::deque<_Tp, _Alloc>::iterator =
std::_Deque_iterator<int, int&, int*>]’:
emplace.cc:5:22:   required from here
.../include/c++/4.8.0/bits/deque.tcc:178:6: error: no matching function for
call to ‘std::deque<int>::push_front()’
.../include/c++/4.8.0/bits/deque.tcc:178:6: note: candidates are:
In file included from .../include/c++/4.8.0/deque:65:0,
                 from emplace.cc:1:
.../include/c++/4.8.0/bits/stl_deque.h:1357:7: note: void std::deque<_Tp,
_Alloc>::push_front(const value_type&) [with _Tp = int; _Alloc =
std::allocator<int>; std::deque<_Tp, _Alloc>::value_type = int]
.../include/c++/4.8.0/bits/stl_deque.h:1357:7: note:   candidate expects 1
argument, 0 provided
.../include/c++/4.8.0/bits/stl_deque.h:1370:7: note: void std::deque<_Tp,
_Alloc>::push_front(std::deque<_Tp, _Alloc>::value_type&&) [with _Tp = int;
_Alloc = std::allocator<int>; std::deque<_Tp, _Alloc>::value_type = int]
.../include/c++/4.8.0/bits/stl_deque.h:1370:7: note:   candidate expects 1
argument, 0 provided
...


The problem is that deque::emplace(iterator __position, _Args&&... __args)
tries to forward to push_front(std::forward<_Args>(__args)...) instead of
emplace_front(std::forward<_Args>(__args)...), and similarly for *_back().

I haven't checked the other containers for similar problems.

Reply via email to