summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-31 01:56:55 +0000
committerAndrew Pinski <apinski@cavium.com>2012-04-11 14:51:11 -0700
commitdbaa501f7eae4f2565ee8832283f246458f010bb (patch)
tree7cdaf802bd2118466501c7265e62a77509e6a2f8
parent64d99b2c6ed2c70e642cf86065957cd1adbc775a (diff)
downloadgcc-dbaa501f7eae4f2565ee8832283f246458f010bb.tar.gz
2012-03-30 Jeffrey Yasskin <jyasskin@gcc.gnu.org>
Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/52799 * include/bits/deque.tcc (emplace): Fix thinko, replace push_front -> emplace_front, and likewise for *_back. * testsuite/23_containers/deque/modifiers/emplace/52799.cc: New. * testsuite/23_containers/list/modifiers/emplace/52799.cc: Likewise. * testsuite/23_containers/vector/modifiers/emplace/52799.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186035 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/include/bits/deque.tcc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/modifiers/emplace/52799.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/emplace/52799.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/52799.cc28
5 files changed, 97 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 4f29ab4b3f7..46923dcb828 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2012-03-30 Jeffrey Yasskin <jyasskin@gcc.gnu.org>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/52799
+ * include/bits/deque.tcc (emplace): Fix thinko, replace push_front
+ -> emplace_front, and likewise for *_back.
+ * testsuite/23_containers/deque/modifiers/emplace/52799.cc: New.
+ * testsuite/23_containers/list/modifiers/emplace/52799.cc: Likewise.
+ * testsuite/23_containers/vector/modifiers/emplace/52799.cc: Likewise.
+
2012-03-28 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/52689
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index 5b56875b493..fcece60c8bb 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -1,7 +1,7 @@
// Deque implementation (out of line) -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-// 2009, 2010, 2011
+// 2009, 2010, 2011, 2012
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -175,12 +175,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{
if (__position._M_cur == this->_M_impl._M_start._M_cur)
{
- push_front(std::forward<_Args>(__args)...);
+ emplace_front(std::forward<_Args>(__args)...);
return this->_M_impl._M_start;
}
else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
{
- push_back(std::forward<_Args>(__args)...);
+ emplace_back(std::forward<_Args>(__args)...);
iterator __tmp = this->_M_impl._M_finish;
--__tmp;
return __tmp;
diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/emplace/52799.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/emplace/52799.cc
new file mode 100644
index 00000000000..35c4c44ef90
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/emplace/52799.cc
@@ -0,0 +1,28 @@
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <deque>
+
+// libstdc++/52799
+int main()
+{
+ std::deque<int> d;
+ d.emplace(d.begin());
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/emplace/52799.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/emplace/52799.cc
new file mode 100644
index 00000000000..314dd4a8044
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/emplace/52799.cc
@@ -0,0 +1,28 @@
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <list>
+
+// libstdc++/52799
+int main()
+{
+ std::list<int> l;
+ l.emplace(l.begin());
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/52799.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/52799.cc
new file mode 100644
index 00000000000..f43057e968c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/emplace/52799.cc
@@ -0,0 +1,28 @@
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+
+// libstdc++/52799
+int main()
+{
+ std::vector<int> v;
+ v.emplace(v.begin());
+}