This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Fix libstdc++/6513
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com, bkoz <bkoz at redhat dot com>
- Date: Wed, 01 May 2002 04:23:55 +0200
- Subject: [v3] Fix libstdc++/6513
Hi,
the below fixes a nasty typo in stl_uninitialized.h, which caused a
serious regression from 3.0.x.
Tested i686-pc-linux-gnu, approved by Benjamin Kosnik and committed to
trunk.
Mark are we still in time for 3.1.0??
Ciao,
Paolo.
///////////////////
2002-05-01 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/6513
* include/bits/stl_uninitialized.h
(uninitialized_copy(_InputIter, _InputIter, _ForwardIter)):
Fix typo in 2001-07-17 commit: typedef _ValueType to
iterator_traits<_ForwardIter> not <_InputIter>.
* testsuite/23_containers/vector_ctor.cc: Add test04.
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_uninitialized.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- gcc/libstdc++-v3/include/bits/stl_uninitialized.h 2002/01/04 21:27:32 1.12
+++ gcc/libstdc++-v3/include/bits/stl_uninitialized.h 2002/05/01 02:17:33 1.13
@@ -107,7 +107,7 @@
inline _ForwardIter
uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)
{
- typedef typename iterator_traits<_InputIter>::value_type _ValueType;
+ typedef typename iterator_traits<_ForwardIter>::value_type _ValueType;
typedef typename __type_traits<_ValueType>::is_POD_type _Is_POD;
return __uninitialized_copy_aux(__first, __last, __result, _Is_POD());
}
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/23_containers/vector_ctor.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- gcc/libstdc++-v3/testsuite/23_containers/vector_ctor.cc 2001/08/07 03:38:30 1.7
+++ gcc/libstdc++-v3/testsuite/23_containers/vector_ctor.cc 2002/05/01 02:17:35 1.8
@@ -21,6 +21,7 @@
// 23.2.4.1 vector constructors, copy, and assignment
#include <vector>
+#include <string>
#include <testsuite_hooks.h>
template<typename T>
@@ -81,11 +82,24 @@
#endif
}
+// libstdc++/6513
+void test04()
+{
+ bool test = true;
+ const char* c_strings[5] = { "1", "2", "3", "4", "5" };
+ std::vector<std::string> strings(c_strings, c_strings + 5);
+
+#ifdef DEBUG_ASSERT
+ assert(test);
+#endif
+}
+
int main()
{
test01();
test02();
test03();
+ test04();
return 0;
}