Fix boost::shared_ptr<T>::operator[] for non-array T's
This commit is contained in:
parent
eccf21b3c1
commit
76691c3d42
88
boost-1.54.0-smart_ptr-shared_ptr_at.patch
Normal file
88
boost-1.54.0-smart_ptr-shared_ptr_at.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
From f65c57d9d2a4f535e36c96b7f563574634e46b02 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Dimov <pdimov@pdimov.com>
|
||||||
|
Date: Wed, 12 Nov 2014 19:04:29 +0200
|
||||||
|
Subject: [PATCH] Fix explicit instantiation regression
|
||||||
|
|
||||||
|
---
|
||||||
|
include/boost/smart_ptr/shared_ptr.hpp | 2 +-
|
||||||
|
test/Jamfile.v2 | 2 ++
|
||||||
|
test/array_fail_array_access.cpp | 6 +++++-
|
||||||
|
test/sp_explicit_inst_test.cpp | 23 +++++++++++++++++++++++
|
||||||
|
4 files changed, 31 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 test/sp_explicit_inst_test.cpp
|
||||||
|
|
||||||
|
diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp
|
||||||
|
index 82ece8b..8be92ab 100644
|
||||||
|
--- a/boost/smart_ptr/shared_ptr.hpp
|
||||||
|
+++ b/boost/smart_ptr/shared_ptr.hpp
|
||||||
|
@@ -655,7 +655,7 @@ public:
|
||||||
|
BOOST_ASSERT( px != 0 );
|
||||||
|
BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) );
|
||||||
|
|
||||||
|
- return px[ i ];
|
||||||
|
+ return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
element_type * get() const BOOST_NOEXCEPT
|
||||||
|
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
|
||||||
|
index 027367c..0b51eee 100644
|
||||||
|
--- a/libs/smart_ptr/test/Jamfile.v2
|
||||||
|
+++ b/libs/smart_ptr/test/Jamfile.v2
|
||||||
|
@@ -153,5 +153,7 @@ import testing ;
|
||||||
|
[ run allocate_shared_array_throws_test.cpp ]
|
||||||
|
[ run allocate_shared_array_esft_test.cpp ]
|
||||||
|
[ run allocate_shared_array_args_test.cpp ]
|
||||||
|
+
|
||||||
|
+ [ compile sp_explicit_inst_test.cpp ]
|
||||||
|
;
|
||||||
|
}
|
||||||
|
diff --git a/test/array_fail_array_access.cpp b/test/array_fail_array_access.cpp
|
||||||
|
index abfacbe..4f4e3f8 100644
|
||||||
|
--- a/libs/smart_ptr/test/array_fail_array_access.cpp
|
||||||
|
+++ b/libs/smart_ptr/test/array_fail_array_access.cpp
|
||||||
|
@@ -12,8 +12,12 @@ struct X
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
+template<class T> void f( T & /*t*/ )
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::shared_ptr<X> px( new X );
|
||||||
|
- px[ 0 ];
|
||||||
|
+ f( px[ 0 ] );
|
||||||
|
}
|
||||||
|
diff --git a/test/sp_explicit_inst_test.cpp b/test/sp_explicit_inst_test.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..d8de782
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/libs/smart_ptr/test/sp_explicit_inst_test.cpp
|
||||||
|
@@ -0,0 +1,23 @@
|
||||||
|
+//
|
||||||
|
+// Explicit instantiations are reported to exist in user code
|
||||||
|
+//
|
||||||
|
+// Copyright (c) 2014 Peter Dimov
|
||||||
|
+//
|
||||||
|
+// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
+//
|
||||||
|
+
|
||||||
|
+#include <boost/shared_ptr.hpp>
|
||||||
|
+
|
||||||
|
+template class boost::shared_ptr< int >;
|
||||||
|
+
|
||||||
|
+struct X
|
||||||
|
+{
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+template class boost::shared_ptr< X >;
|
||||||
|
+
|
||||||
|
+int main()
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
10
boost.spec
10
boost.spec
@ -36,7 +36,7 @@ Name: boost
|
|||||||
Summary: The free peer-reviewed portable C++ source libraries
|
Summary: The free peer-reviewed portable C++ source libraries
|
||||||
Version: 1.55.0
|
Version: 1.55.0
|
||||||
%define version_enc 1_55_0
|
%define version_enc 1_55_0
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
License: Boost and MIT and Python
|
License: Boost and MIT and Python
|
||||||
|
|
||||||
%define toplev_dirname %{name}_%{version_enc}
|
%define toplev_dirname %{name}_%{version_enc}
|
||||||
@ -157,6 +157,9 @@ Patch56: boost-1.55.0-xpressive-unused_typedefs.patch
|
|||||||
# Fixed upstream on Aug 20 05:11:14 2013.
|
# Fixed upstream on Aug 20 05:11:14 2013.
|
||||||
Patch57: boost-1.55.0-spirit-unused_typedefs.patch
|
Patch57: boost-1.55.0-spirit-unused_typedefs.patch
|
||||||
|
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1159960
|
||||||
|
Patch58: boost-1.54.0-smart_ptr-shared_ptr_at.patch
|
||||||
|
|
||||||
%bcond_with tests
|
%bcond_with tests
|
||||||
%bcond_with docs_generated
|
%bcond_with docs_generated
|
||||||
|
|
||||||
@ -643,6 +646,7 @@ a number of significant features and is now developed independently
|
|||||||
%patch55 -p1
|
%patch55 -p1
|
||||||
%patch56 -p1
|
%patch56 -p1
|
||||||
%patch57 -p1
|
%patch57 -p1
|
||||||
|
%patch58 -p1
|
||||||
|
|
||||||
# At least python2_version needs to be a macro so that it's visible in
|
# At least python2_version needs to be a macro so that it's visible in
|
||||||
# %%install as well.
|
# %%install as well.
|
||||||
@ -1245,6 +1249,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_mandir}/man1/bjam.1*
|
%{_mandir}/man1/bjam.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Nov 12 2014 Petr Machata <pmachata@redhat.com> - 1.55.0-5
|
||||||
|
- Fix boost::shared_ptr<T>::operator[], which was ill-formed for
|
||||||
|
non-array T's. (boost-1.54.0-smart_ptr-shared_ptr_at.patch)
|
||||||
|
|
||||||
* Tue Aug 26 2014 David Tardon <dtardon@redhat.com> - 1.55.0-4
|
* Tue Aug 26 2014 David Tardon <dtardon@redhat.com> - 1.55.0-4
|
||||||
- rebuild for ICU 53.1
|
- rebuild for ICU 53.1
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user