In VS2013 update 5, I\'ve got this:
class Lock
{
public:
Lock(CriticalSection& cs) : cs_(cs)
{}
Lock(const Lock&) = delete;
Lock(Lock&am
If that compiles, it is a bug in the compiler. VC2015 correctly fails to compile it.
class Foo
{
public:
Foo() {}
Foo(const Foo&) = delete;
Foo(Foo&&) = delete;
};
Foo Bar()
{
return Foo();
}
Gives me:
xxx.cpp(327): error C2280: 'Foo::Foo(Foo &&)': attempting to reference a deleted function
and g++ 4.9 says:
error : use of deleted function 'Foo::Foo(Foo&&)'
The standard is very clear that a copy constructor or move constructor must exist and be accessible, even if RVO means it is not invoked.