Ticket #12615 (closed Bugs: fixed)
any_cast should use addressof instead of operator &
|Reported by:||vishalshetye@…||Owned by:||apolukhin|
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++.
- Owner changed from nasonov to apolukhin
- Status changed from new to assigned