Description of problem: Compiling this simple c++ file gives error: #include <boost/tr1/memory.hpp> template class boost::shared_ptr<int>; main() { } Version-Release number of selected component (if applicable): gcc-4.8.3-7.fc20.x86_64 boost-1.54.0-9.fc20.x86_64 How reproducible: Always Steps to Reproduce: 1. cat << __EOF__ > foo.cc #include <boost/tr1/memory.hpp> template class boost::shared_ptr<int>; main() { } __EOF__ 2. gcc -o foo foo.cc 3. Actual results: g++ complains: In file included from /usr/include/boost/shared_ptr.hpp:17:0, from /usr/include/boost/tr1/memory.hpp:56, from foo.cc:1: /usr/include/boost/smart_ptr/shared_ptr.hpp: In instantiation of 'typename boost::detail::sp_array_access<T>::type boost::shared_ptr<T>::operator[](std::ptrdiff_t) const [with T = int; typename boost::detail::sp_array_access<T>::type = void; std::ptrdiff_t = long int]': foo.cc:3:23: required from here /usr/include/boost/smart_ptr/shared_ptr.hpp:663:22: error: return-statement with a value, in function returning 'void' [-fpermissive] return px[ i ]; Expected results: succesful compilation. Additional info:
I sent an inquiry upstream, and Peter Dimov suggested this fix: diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp index 82ece8b..f275f6c 100644 --- a/include/boost/smart_ptr/shared_ptr.hpp +++ b/include/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 typename boost::detail::sp_array_access< T >::type (px[ i ]); } element_type * get() const BOOST_NOEXCEPT ... which works. It does however cause a failure in one of the test cases (array_fail_array_access.cpp). But that test just checks that subscription operator is absent or doesn't compile. It now compiles and doesn't return any values, which might be good enough. Maybe the test can be adapted or disregarded. Let's see, the discussion continues.
boost-1.55.0-4.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/boost-1.55.0-4.fc21
boost-1.54.0-10.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/boost-1.54.0-10.fc20
Package boost-1.55.0-4.fc21: * should fix your issue, * was pushed to the Fedora 21 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing boost-1.55.0-4.fc21' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-14893/boost-1.55.0-4.fc21 then log in and leave karma (feedback).
boost-1.55.0-4.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.
boost-1.54.0-10.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.