[Boost-bugs] [Boost C++ Libraries] #7079: addressof a boost::function and SolarisStudio compiler

Subject: [Boost-bugs] [Boost C++ Libraries] #7079: addressof a boost::function and SolarisStudio compiler
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-04 15:01:50


#7079: addressof a boost::function and SolarisStudio compiler
------------------------------------------------------+---------------------
 Reporter: Luke Elliott <lukester_null@…> | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: utility
  Version: Boost 1.50.0 | Severity: Problem
 Keywords: |
------------------------------------------------------+---------------------
 This:

 {{{
 #include <boost/utility/addressof.hpp>
 #include <boost/function.hpp>

 int main()
 {
     boost::function<void (void)> pFunc;
     boost::addressof(pFunc);
     return 0;
 }
 }}}

 fails with:

 CC address-of.cpp -I/path/to/boost -library=stlport4
 ".../addressof.hpp", line 61: Error: Could not find a match for
 boost::detail::addressof_impl<boost::function<void()>>::f(boost::detail::addr_impl_ref<boost::function<void()>>,
 int) needed in
 boost::addressof<boost::function<void()>>(boost::function<void()>&).
 "address-of.cpp", line 8: Where: While instantiating
 "boost::addressof<boost::function<void()>>(boost::function<void()>&)".
 "address-of.cpp", line 8: Where: Instantiated from non-template code.

 Handily the existing workaround in addressof.hpp fixes it if extended to
 check for Sun...

 {{{
 template<class T> T * addressof( T & v )
 {
 #if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__,
 BOOST_TESTED_AT( 0x610 ) ) ) || defined( __SUNPRO_CC )

     return Boost::detail::addressof_impl<T>::f( v, 0 );

 #else

     return Boost::detail::addressof_impl<T>::f(
 Boost::detail::addr_impl_ref<T>( v ), 0 );

 #endif
 }
 }}}

 Compiler info:
 {{{
 CC -V
 CC: Sun C++ 5.12 SunOS_i386 2011/11/16
 }}}

 I'm not sure if this is really the correct solution (addressof_test
 passes), but I hope it is of some use!

 Regards

 Luke Elliott.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7079>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC