Opened 4 years ago

Closed 4 years ago

#8988 closed Bugs (fixed)

Boost.variant can not work with const rvalues

Reported by: apolukhin Owned by: apolukhin
Milestone: Boost 1.55.0 Component: variant
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc: antoshkka@…


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 apolukhin

  • Cc antoshkka@… added
  • Owner changed from ebf to apolukhin
  • Status changed from new to assigned

comment:2 Changed 4 years ago by apolukhin

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

comment:3 Changed 4 years ago by apolukhin

  • Resolution set to fixed
  • Status changed from assigned to 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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain apolukhin.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.