Modify

Opened 4 years ago

Closed 4 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').

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by Antony Polukhin

Cc: antoshkka@… added
Owner: changed from ebf to Antony Polukhin
Status: newassigned

comment:2 Changed 4 years ago by Antony Polukhin

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

comment:3 Changed 4 years ago by Antony Polukhin

Resolution: fixed
Status: assignedclosed

(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

Modify Ticket

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