|
|
dc1507 |
2012-10-09 Benjamin Kosnik <bkoz@redhat.com>
|
|
|
dc1507 |
|
|
|
dc1507 |
* testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc:
|
|
|
dc1507 |
Fix constant value.
|
|
|
dc1507 |
|
|
|
dc1507 |
2012-04-17 Benjamin Kosnik <bkoz@redhat.com>
|
|
|
dc1507 |
|
|
|
dc1507 |
* testsuite/20_util/specialized_algorithms/uninitialized_copy/
|
|
|
dc1507 |
808590.cc: New.
|
|
|
dc1507 |
|
|
|
dc1507 |
2009-09-02 Paolo Carlini <paolo.carlini@oracle.com>
|
|
|
dc1507 |
|
|
|
dc1507 |
* include/bits/stl_uninitialized.h
|
|
|
dc1507 |
(__uninitialized_copy::uninitialized_copy): Just call (the now
|
|
|
dc1507 |
forwarding) _Construct.
|
|
|
dc1507 |
|
|
|
dc1507 |
2009-08-29 Benjamin Kosnik <bkoz@redhat.com>
|
|
|
dc1507 |
Chris Jefferson <chris@bubblescope.net>
|
|
|
dc1507 |
|
|
|
dc1507 |
* include/bits/stl_construct.h (_Construct(_T1*, _T2&&)): Add in
|
|
|
dc1507 |
C++0x mode.
|
|
|
dc1507 |
|
|
|
dc1507 |
--- libstdc++-v3/include/bits/stl_construct.h (revision 186113)
|
|
|
dc1507 |
+++ libstdc++-v3/include/bits/stl_construct.h (working copy)
|
|
|
dc1507 |
@@ -67,12 +67,19 @@
|
|
|
dc1507 |
*/
|
|
|
dc1507 |
template<typename _T1, typename _T2>
|
|
|
dc1507 |
inline void
|
|
|
dc1507 |
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
|
dc1507 |
+ _Construct(_T1* __p, _T2&& __value)
|
|
|
dc1507 |
+ {
|
|
|
dc1507 |
+ ::new(static_cast<void*>(__p)) _T1(std::forward<_T2>(__value));
|
|
|
dc1507 |
+ }
|
|
|
dc1507 |
+#else
|
|
|
dc1507 |
_Construct(_T1* __p, const _T2& __value)
|
|
|
dc1507 |
{
|
|
|
dc1507 |
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
dc1507 |
// 402. wrong new expression in [some_]allocator::construct
|
|
|
dc1507 |
::new(static_cast<void*>(__p)) _T1(__value);
|
|
|
dc1507 |
}
|
|
|
dc1507 |
+#endif
|
|
|
dc1507 |
|
|
|
dc1507 |
/**
|
|
|
dc1507 |
* Destroy the object pointed to by a pointer type.
|
|
|
dc1507 |
--- libstdc++-v3/include/bits/stl_uninitialized.h (revision 186113)
|
|
|
dc1507 |
+++ libstdc++-v3/include/bits/stl_uninitialized.h (working copy)
|
|
|
dc1507 |
@@ -71,8 +71,7 @@
|
|
|
dc1507 |
__try
|
|
|
dc1507 |
{
|
|
|
dc1507 |
for (; __first != __last; ++__first, ++__cur)
|
|
|
dc1507 |
- ::new(static_cast<void*>(&*__cur)) typename
|
|
|
dc1507 |
- iterator_traits<_ForwardIterator>::value_type(*__first);
|
|
|
dc1507 |
+ std::_Construct(&*__cur, *__first);
|
|
|
dc1507 |
return __cur;
|
|
|
dc1507 |
}
|
|
|
dc1507 |
__catch(...)
|
|
|
dc1507 |
--- libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc (revision 0)
|
|
|
dc1507 |
+++ libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc (revision 186539)
|
|
|
dc1507 |
@@ -0,0 +1,48 @@
|
|
|
dc1507 |
+// Copyright (C) 2012 Free Software Foundation, Inc.
|
|
|
dc1507 |
+//
|
|
|
dc1507 |
+// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
dc1507 |
+// software; you can redistribute it and/or modify it under the
|
|
|
dc1507 |
+// terms of the GNU General Public License as published by the
|
|
|
dc1507 |
+// Free Software Foundation; either version 3, or (at your option)
|
|
|
dc1507 |
+// any later version.
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+// This library is distributed in the hope that it will be useful,
|
|
|
dc1507 |
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
|
|
|
dc1507 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
dc1507 |
+// GNU General Public License for more details.
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+// You should have received a copy of the GNU General Public License along
|
|
|
dc1507 |
+// with this library; see the file COPYING3. If not see
|
|
|
dc1507 |
+// <http://www.gnu.org/licenses/>.
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+#include <vector>
|
|
|
dc1507 |
+#include <stdexcept>
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+// 4.4.x only
|
|
|
dc1507 |
+struct c
|
|
|
dc1507 |
+{
|
|
|
dc1507 |
+ void *m;
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+ c(void* o = 0) : m(o) {}
|
|
|
dc1507 |
+ c(const c &r) : m(r.m) {}
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+ template<class T>
|
|
|
dc1507 |
+ explicit c(T &o) : m((void*)0xdeadbeef) { }
|
|
|
dc1507 |
+};
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+int main()
|
|
|
dc1507 |
+{
|
|
|
dc1507 |
+ std::vector<c> cbs;
|
|
|
dc1507 |
+ const c cb((void*)0xcafebabe);
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+ for (int fd = 62; fd < 67; ++fd)
|
|
|
dc1507 |
+ {
|
|
|
dc1507 |
+ cbs.resize(fd + 1);
|
|
|
dc1507 |
+ cbs[fd] = cb;
|
|
|
dc1507 |
+ }
|
|
|
dc1507 |
+
|
|
|
dc1507 |
+ for (int fd = 62; fd< 67; ++fd)
|
|
|
dc1507 |
+ if (cb.m != cbs[fd].m)
|
|
|
dc1507 |
+ throw std::runtime_error("wrong");
|
|
|
dc1507 |
+ return 0;
|
|
|
dc1507 |
+}
|