Modify

Opened 12 months ago

Closed 7 months ago

#12615 closed Bugs (fixed)

any_cast should use addressof instead of operator &

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

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

Download all attachments as: .zip

Change History (6)

Changed 12 months ago by vishalshetye@…

Attachment: test.cpp added

sample code

Changed 12 months ago by vishalshetye@…

Attachment: any_patch.txt added

sample patch

comment:1 Changed 11 months ago by Antony Polukhin

Owner: changed from nasonov to Antony Polukhin
Status: newassigned

comment:2 Changed 11 months ago by Antony Polukhin

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

comment:3 Changed 10 months ago by Antony Polukhin

Milestone: To Be DeterminedBoost 1.64.0

comment:4 Changed 7 months ago by Antony Polukhin

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Antony Polukhin.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.