Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#7079 closed Bugs (fixed)

addressof a boost::function and SolarisStudio compiler

Reported by: Luke Elliott <lukester_null@…> Owned by: viboes
Milestone: Boost 1.54.0 Component: utility
Version: Boost 1.50.0 Severity: Problem
Keywords: Cc:



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

int main()
    boost::function<void (void)> 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 );


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


Compiler info:

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!


Luke Elliott.

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by Matt Stupple <matt_stupple@…>

Can I 'vote' for this fix to be integrated into the main Boost release? I hit exactly the same error with Solaris Studio 12.3 (CC 5.12) and the suggested solution works perfectly for me.

comment:2 Changed 4 years ago by viboes

  • Owner changed from no-maintainer to viboes
  • Status changed from new to assigned

comment:3 Changed 4 years ago by viboes

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [83524]) Utility/address_off: fix #7079.

comment:4 Changed 4 years ago by viboes

  • Milestone changed from To Be Determined to Boost 1.54.0

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain viboes.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.