Boost logo

Boost Users :

Subject: [Boost-users] boost::addressof and std::nullptr_t
From: Mathieu Champlon (m.champlon_at_[hidden])
Date: 2013-05-12 02:05:34


Hello,

With MSVC 2010 the following code fails to compile :

     std::nullptr_t np;
     boost::addressof( np );

The error being :

1>....\boost/utility/addressof.hpp(59): error C2666:
'boost::detail::addressof_impl<T>::f' : 2 overloads have similar conversions
1> with
1> [
1> T=std::nullptr_t
1> ]
1> ....\boost/utility/addressof.hpp(43): could be
'std::nullptr_t *boost::detail::addressof_impl<T>::f(T *,int)'
1> with
1> [
1> T=std::nullptr_t
1> ]
1> ....\boost/utility/addressof.hpp(37): or 'std::nullptr_t
*boost::detail::addressof_impl<T>::f(T &,long)'
1> with
1> [
1> T=std::nullptr_t
1> ]
1> while trying to match the argument list
'(boost::detail::addr_impl_ref<T>, int)'
1> with
1> [
1> T=std::nullptr_t
1> ]
1> ....blabla.cpp(356) : see reference to function template
instantiation 'T *boost::addressof<std::nullptr_t>(T &)' being compiled
1> with
1> [
1> T=std::nullptr_t
1> ]

Can this be considered a bug in boost::addressof ?

As a side note it compiles with std::addressof which implementation for
MSVC 2010 is simply :

template<class _Ty> inline
     _Ty * addressof(_Ty& _Val)
     { // return address of _Val
     return ((_Ty *) &(char&)_Val);
     }

Thank you,
MAT.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net