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] |
In C++17 the emplace_front and emplace_back members return a reference. There isn't a very neat way to implement this, so it's just lots of conditional compilation. This isn't an ABI break, because these member functions are templates and so the return type is part of the mangled name. We can't apply it retroactively to older standards though, because it breaks code that is valid in C++14, such as: void f(std::vector<int>& v) { return v.emplace_back(1); } * doc/xml/manual/status_cxx2017.xml: Update status. * doc/html/*: Regenerate. * include/bits/deque.tcc (deque::emplace_front, deque::emplace_back): Return a reference in C++17 mode. * include/bits/forward_list.h (forward_list::emplace_front): Likewise. * include/bits/stl_bvector.h (vector<bool>::emplace_back): Likewise. * include/bits/stl_deque.h (deque::emplace_front, deque::emplace_back): Likewise. * include/bits/stl_list.h (list::emplace_front, list::emplace_back): Likewise. * include/bits/stl_queue.h (queue::emplace): Likewise. * include/bits/stl_stack.h (stack::emplace): Likewise. * include/bits/stl_vector.h (vector::emplace_back): Likewise. * include/bits/vector.tcc (vector::emplace_back): Likewise. * include/debug/deque (__gnu_debug::deque::emplace_front) (__gnu_debug::deque::emplace_back): Likewise. * include/debug/vector (__gnu_debug::vector::emplace_back): Likewise. * testsuite/23_containers/deque/modifiers/emplace/cxx17_return.cc: New. * testsuite/23_containers/forward_list/modifiers/ emplace_cxx17_return.cc: New. * testsuite/23_containers/list/modifiers/emplace/cxx17_return.cc: New. * testsuite/23_containers/queue/members/emplace_cxx17_return.cc: New. * testsuite/23_containers/stack/members/emplace_cxx17_return.cc: New. * testsuite/23_containers/vector/bool/emplace_cxx17_return.cc: New. * testsuite/23_containers/vector/modifiers/emplace/cxx17_return.cc: New. Tested powerpc64le-linux, committed to trunk.
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |