Add std::vector::emplace() testcase from LWG 2164
authorJonathan Wakely <jwakely@redhat.com>
Tue, 12 Jul 2016 14:00:11 +0000 (15:00 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 12 Jul 2016 14:00:11 +0000 (15:00 +0100)
* testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc:
Add testcase from LWG 2164.

From-SVN: r238243

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc

index 1d0abe1c242ab193cc6a6913ac300306f061cc4c..d0f14045647e96c35a16f6ea6c2caf0f5b953a85 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-12  Jonathan Wakely  <jwakely@redhat.com>
+
+       * testsuite/23_containers/vector/modifiers/emplace/self_emplace.cc:
+       Add testcase from LWG 2164.
+
 2016-07-11  François Dumont  <fdumont@gcc.gnu.org>
 
        * include/bits/stl_vector.h (push_back(const value_type&)): Forward
index d452b5b6325adfb985e967612081174abf440236..8712216cc3df68b9cefa6619ca08188e273ef760 100644 (file)
@@ -135,6 +135,20 @@ test04()
   VERIFY( va[0]._i == 1 );
 }
 
+void
+test05()
+{
+  // LWG DR 2164
+  std::vector<int> 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();