Modify

Ticket #12615 (closed Bugs: fixed)

Opened 5 months ago

Last modified 8 days ago

any_cast should use addressof instead of operator &

Reported by: vishalshetye@… Owned by: apolukhin
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

test.cpp (1.3 KB) - added by vishalshetye@… 5 months ago.
sample code
any_patch.txt (1.3 KB) - added by vishalshetye@… 5 months ago.
sample patch

Change History

Changed 5 months ago by vishalshetye@…

sample code

Changed 5 months ago by vishalshetye@…

sample patch

comment:1 Changed 4 months ago by apolukhin

  • Owner changed from nasonov to apolukhin
  • Status changed from new to assigned

comment:2 Changed 4 months ago by apolukhin

Fixed in develop branch 7260f203. Will be merged into the master branche after the tests pass.

comment:3 Changed 3 months ago by apolukhin

  • Milestone changed from To Be Determined to Boost 1.64.0

comment:4 Changed 8 days ago by apolukhin

  • Status changed from assigned to closed
  • Resolution set to fixed
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.