Opened 9 years ago

Closed 6 years 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:

Description

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();

}

Change History (5)

comment:1 by Antony Polukhin, 9 years ago

Owner: changed from ebf to Antony Polukhin
Status: newassigned

comment:2 by Antony Polukhin, 9 years ago

This issue was discussed at mailing lists here.

comment:3 by Antony Polukhin, 6 years ago

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 by Antony Polukhin, 6 years ago

Test added in 85d7a5c7, typo fixed in 9f234aef

comment:5 by Antony Polukhin, 6 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.