summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authoraaw <aaw@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-03 15:26:36 +0000
committeraaw <aaw@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-03 15:26:36 +0000
commit9e51d05168478026b3d525c5b761f88b2abb924c (patch)
treea0e32d6292321994a4b6166b17345cce6227d004 /libstdc++-v3
parent99fade12b53ba208ba3354b45e2953a01ba44b23 (diff)
downloadgcc-9e51d05168478026b3d525c5b761f88b2abb924c.tar.gz
2012-08-03 Ollie Wild <aaw@google.com>
Richard Smith <richardsmith@google.com> * include/bits/stl_map.h (operator[](key_type&&)): Replace std::make_pair with value_type. * testsuite/23_containers/map/operators/2.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190128 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/stl_map.h2
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/operators/2.cc38
3 files changed, 46 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 26991cb4d3c..3e94f240208 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2012-08-03 Ollie Wild <aaw@google.com>
+ Richard Smith <richardsmith@google.com>
+
+ * include/bits/stl_map.h (operator[](key_type&&)): Replace
+ std::make_pair with value_type.
+ * testsuite/23_containers/map/operators/2.cc: New test.
+
2012-08-03 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/memory: Include auto_ptr.h later.
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index cfd478a3b92..a3abdd4d5fc 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -475,7 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
iterator __i = lower_bound(__k);
// __i->first is greater than or equivalent to __k.
if (__i == end() || key_comp()(__k, (*__i).first))
- __i = insert(__i, std::make_pair(std::move(__k), mapped_type()));
+ __i = insert(__i, value_type(std::move(__k), mapped_type()));
return (*__i).second;
}
#endif
diff --git a/libstdc++-v3/testsuite/23_containers/map/operators/2.cc b/libstdc++-v3/testsuite/23_containers/map/operators/2.cc
new file mode 100644
index 00000000000..ce633d72ae6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/operators/2.cc
@@ -0,0 +1,38 @@
+// 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/>.
+
+// 23.4.4 template class map
+
+// This test verifies that the value type of a map need not be default
+// copyable.
+
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+#include <map>
+
+struct Mapped {
+ Mapped();
+ explicit Mapped(const Mapped&);
+};
+
+Mapped & foo()
+{
+ std::map<int, Mapped> m;
+ return m[0];
+}