Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::variant & c++11
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-05-16 03:05:13


2013/5/16 Bryan Catanzaro <bcatanzaro_at_[hidden]>:
> Thanks for taking a look.
>
> I checked, and on my system, you're right: adding a non-const conversion
> operator allows the code to compile with c++11 and boost 1.53.0. Although
> I'm not sure why adding a non-const conversion operator would be expected to
> ensure the implicit conversion happens. I would expect the non-const
> conversion operator couldn't be called on a temporary object (maybe things
> are different when we have rvalue references?)

Looks like things are different with rvalues. Visual Studio has
rvalues enables by default and I know no way to disable them.

BTW, MSVC10 and MSVC11 fail to compile all the tests even on Boost
1.48. Even those tests, that pass well on GCC and Clang (like
`my_variant y1 = static_cast<const convertible&>(c)`) fail. Adding
nonconst conversion operator did not help.

All this stuff looks like a bug in some of compilers. I'll try to find
correct behavior in C++ Standard and bug report to compiler
developers.

--
Best regards,
Antony Polukhin

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net