Opened 9 years ago
Closed 9 years ago
#8988 closed Bugs (fixed)
Boost.variant can not work with const rvalues
| Reported by: | Antony Polukhin | Owned by: | Antony Polukhin | 
|---|---|---|---|
| Milestone: | Boost 1.55.0 | Component: | variant | 
| Version: | Boost 1.54.0 | Severity: | Problem | 
| Keywords: | Cc: | antoshkka@… | 
Description
Thanks to gast128! he found the following bug and reported it in mailing lists:
I get a compilation error with Boost.Variant (which compiles fine on previous releases) with vstudio 2010 when a function returns a const Boost.Variant, e.g.:
typedef boost::variant<int, double> Variant;
const Variant GetVar()
{
  return Variant();
}
void TestVariantDnc()
{
   const Variant var = GetVar();
}
This gives error C2666 ('boost::variant<T0_,T1>::convert_construct' : 3 overloads have similar conversions').
Change History (3)
comment:1 by , 9 years ago
| Cc: | added | 
|---|---|
| Owner: | changed from to | 
| Status: | new → assigned | 
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
(In [85408]) Merge from trunk:
- Fix issue with const rvalue references in Boost.Variant (fixes #8988)
- Get rid of Boost.Variant hand written non-usable move emulation and use Boost.Move instead(refs #7601). This does not mean that Boost.Variant supports move emulation now, but removes duplicate/non-working code and makes sure that Boost.Variant is able to work with boost::move
  Note:
 See   TracTickets
 for help on using tickets.
    

(In [85315]) Fix issue with const rvalue references in Boost.Variant (refs #8988)