Opened 9 years ago
Closed 6 years ago
#8555 closed Bugs (fixed)
Variant, Implicit Conversions and C++11
Reported by: | 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 , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
comment:3 by , 6 years ago
Milestone: | To Be Determined → Boost 1.62.0 |
---|
Fixed in b3650685 develop, will be merged to the master branch as soon as the regression tests will cycle.
comment:5 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
This issue was discussed at mailing lists here.