re PR libstdc++/6513 (sigfaults on trivial code)

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.

From-SVN: r52985
This commit is contained in:
Paolo Carlini 2002-05-01 04:17:35 +02:00 committed by Paolo Carlini
parent 08b57fb3ab
commit 072a15d99b
3 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,12 @@
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.
2002-04-30 John David Anglin <dave@hiauly1.hia.nrc.ca>
PR libstdc++/6501

View File

@ -107,7 +107,7 @@ namespace std
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());
}

View File

@ -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 @@ test03()
#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;
}