From 17b31c054cdda9ac6167c548a41c5fb4eca0ebb3 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 12 Jul 2016 15:00:11 +0100 Subject: [PATCH] Add std::vector::emplace() testcase from LWG 2164 * testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc: Add testcase from LWG 2164. From-SVN: r238243 --- libstdc++-v3/ChangeLog | 5 +++++ .../vector/modifiers/emplace/self_emplace.cc | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1d0abe1c242..d0f14045647 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2016-07-12 Jonathan Wakely + + * testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc: + Add testcase from LWG 2164. + 2016-07-11 François Dumont * include/bits/stl_vector.h (push_back(const value_type&)): Forward diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc index d452b5b6325..8712216cc3d 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc @@ -135,6 +135,20 @@ test04() VERIFY( va[0]._i == 1 ); } +void +test05() +{ + // LWG DR 2164 + std::vector v; + v.reserve(4); + v = { 1, 2, 3 }; + v.emplace(v.begin(), v.back()); + VERIFY( v[0] == 3 ); + VERIFY( v[1] == 1 ); + VERIFY( v[2] == 2 ); + VERIFY( v[3] == 3 ); +} + int main() { test01(); -- 2.30.2