Boost logo

Boost :

Subject: Re: [boost] [move] problem with msvc and BOOST_MOVABLE_BUT_NOT_COPYABLE
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2010-05-27 15:28:22


Oliver Kowalke wrote:
> I get an linker error (private: __thiscall X::X(class X &) is
> unresolved symbol) with msvc-9.0 on XP.
> AFAIL (docu) implementing the copy-ctor isn't required and passing
> values from static memeber functions are allowed.
>
> What's wrong?
[snip]
> X X::create()
> {
> X x;
> return x; // passing value form static memeber-fn
> }

The statement "return x" must make some constructor call. As x is not a temporary, the compiler must call the copy constructor. It will probably work if you write "return boost::move(x)" or "return X()".

Regards,
Thomas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk