Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Variant broke in 1.54?
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-08-05 07:56:54


2013/8/4 gast128 <gast128_at_[hidden]>

> Dear all,
>
> 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').
>

I think this is an interesting example. For a copyable and movable type T:
const T f();
int main()
{
  T t = f(); //???

Should this:
a) not compile? (like in the variant example above)
b) use the copy constructor instead of moving?
c) move anyway?

Looks like this is caused by move-emulation for variant, isn't it?

Regards,
Kris



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