Boost logo

Boost :

Subject: Re: [boost] [core] [addressof.hpp] [addressof_test2.cpp] ISO C++ says that these are ambiguous
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-12-25 02:01:38


On Thu, Dec 25, 2014 at 6:01 AM, Peter Dimov <lists_at_[hidden]> wrote:
> Sergey Sprogis wrote:
> ...
>>
>> It looks like he following code fragment from boost/core/addressof.hpp
>> (latest trunk version) violates ISO C++ overloading rules:
>
> ...
>>
>> As a result, libs/core/test/addressof_test2.cpp fails to compile with
>> Oracle Studio 12.4 C++ compiler...
>
>
> That's probably because of the __SUNPRO_CC workaround at addressof.hpp line
> 110:
>
> #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
>
> I assume that defined( __SUNPRO_CC ) needs to be changed to
>
> defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, < something )
>
> but it's been a while since we stopped testing on this compiler so I don't
> know what 'something' must be. It should be set to the earliest version that
> doesn't need the workaround, but the current value of __SUNPRO_CC will also
> work.

Maybe we'd better make this overload differently. I'm thinking about
something like:

  return boost::detail::addressof_impl<T>::f( v, type<T>() );

for all compilers.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk