[Boost-bugs] [Boost C++ Libraries] #12615: any_cast should use addressof instead of operator &

Subject: [Boost-bugs] [Boost C++ Libraries] #12615: any_cast should use addressof instead of operator &
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-11-21 09:24:42


#12615: any_cast should use addressof instead of operator &
------------------------------+---------------------
 Reporter: vishalshetye@… | Owner: nasonov
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: any
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 Please see attached test.cpp file for sample code. I have included
 compiler errors in the form of comments in the same.

 If a class has overloaded operator & then any_cast (which uses & itself)
 results in following type of compilation error.

 {{{
 any.hpp:246:16: error: cannot initialize return object of type
 'ExampleClass<int> *'
 with an rvalue of type 'const int **'
 }}}


 I think fix is to replace use of & operator with std::addressof.
 I have attached diff of changes to any.hpp which worked with clang++.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12615>
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:20 UTC