Opened 6 years ago
Closed 6 years ago
#12615 closed Bugs (fixed)
any_cast should use addressof instead of operator &
Reported by: | Owned by: | Antony Polukhin | |
---|---|---|---|
Milestone: | Boost 1.64.0 | Component: | any |
Version: | Boost 1.61.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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++.
Attachments (2)
Change History (6)
by , 6 years ago
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Fixed in develop branch 7260f203. Will be merged into the master branche after the tests pass.
comment:3 by , 6 years ago
Milestone: | To Be Determined → Boost 1.64.0 |
---|
comment:4 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
sample code