Reputation: 13575
I have short code as below:
#include <memory>
#include <vector>
#include <tuple>
using namespace std;
struct A
{
A() {}
vector<unique_ptr<int>> m;
// Change the above line to "unique_ptr<int> m;" removes the compilation error
// Or add a line "A(A const&) = delete;" removes the compilation error also
};
struct B
{
tuple<A> t;
};
int main()
{
A a;
B b;
return 0;
}
VC2013 NOV CTP compiler gives errors:
error C2280: 'std::unique_ptr<int,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)' : attempting to reference a deleted function xmemory0 593
Is this a compiler bug or code bug?
Upvotes: 0
Views: 451
Reputation: 27370
This was a bug in Visual Studio; according to @Gonmator's comment it's been fixed as of VS2013 Update 1.
It might have been similar to reported bugs such as
https://connect.microsoft.com/VisualStudio/feedback/details/801826/std-tuple-with-rvalue-references-not-working-if-clr-enabled
or
https://connect.microsoft.com/VisualStudio/feedback/details/891428/c-std-pair-has-no-default-move-constructor
— apparently MSVC has had several residual bugs involving "move semantics + std::tuple".
Upvotes: 1