Deleting a function is not the same as not declaring it.
A deleted function is declared and participates in overload resolution, but if you attempt to call it an error is produced.
If you fail to declare your move constructor, the compiler will not create one as you created a copy constructor. Overload resolution on an rvalue will find your copy constructor, which is probably what you want.
What you said with your foo(foo&&)=delete
was "if anyone tries to move construct this object, generate an error".
I can illustrate the difference here:
void do_stuff( int x ) { std::cout << x << "\n"; }
void do_stuff( double ) = delete;
void do_stuff2( int x ) { std::cout << x << "\n"; }
//void do_stuff2( double ) = delete;
int main() {
do_stuff(3); // works
//do_stuff(3.14); // fails to compile
do_stuff2(3); // works
do_stuff2(3.14); // works, calls do_stuff2(int)
}
the only part with your above problem that makes this a bit more confusing is that special member functions are automatically created or not based off slightly arcane rules.