Opened 5 years ago

Closed 16 months ago

#8555 closed Bugs (fixed)

Variant, Implicit Conversions and C++11

Reported by: Bryan Catanzaro <bcatanzaro@…> Owned by: Antony Polukhin
Milestone: Boost 1.62.0 Component: variant
Version: Boost 1.53.0 Severity: Regression
Keywords: Cc:


With c++11 enabled on g++, the following code compiles on Boost 1.48.0, but not on Boost 1.53.0. It appears the machinery choosing construction method thinks I'm trying to convert from a convertible to an int, rather than from a convertible to a my_variant. If I disable c++11, this code compiles with Boost 1.53.0.

Here's the error: /home/bcatanzaro/boost_1_53_0/boost/variant/variant.hpp:1574:9: error: no matching function for call to ‘boost::variant<int>::initializer::initialize(void*, std::remove_reference<convertible&>::type)’

And here's a reproducer:

#include <boost/variant.hpp>

typedef boost::variant<int> my_variant;

struct convertible {

operator my_variant() const {

return my_variant();



int main() {

my_variant y = convertible();


Attachments (0)

Change History (5)

comment:1 Changed 5 years ago by Antony Polukhin

Owner: changed from ebf to Antony Polukhin
Status: newassigned

comment:2 Changed 5 years ago by Antony Polukhin

This issue was discussed at mailing lists here.

comment:3 Changed 21 months ago by Antony Polukhin

Milestone: To Be DeterminedBoost 1.62.0

Fixed in b3650685 develop, will be merged to the master branch as soon as the regression tests will cycle.

comment:4 Changed 21 months ago by Antony Polukhin

Test added in 85d7a5c7, typo fixed in 9f234aef

comment:5 Changed 16 months ago by Antony Polukhin

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
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.